Questions tagged as 'sql'

2
answers

Comparison of two dates using varchar type MySQL

I have a question regarding the preparation of a SQL query in which I pass a registration date and check if it is larger than the current date, but I have a problem the date of registration is varchar and it follows the format "dd / mm / yyyy ",...
asked by 05.07.2017 / 20:26
1
answer

How to convert a varchar type from a column to datetime within a view using SQL?

I have a view with a column of type varchar and I am trying to convert this column to a type date time my code is here: update temp_vertical_dashboard set data = convert (datetime,data,101) temp_vertical_dashboard is my view and date is the...
asked by 21.06.2017 / 13:42
1
answer

SQL comparison with values written in different ways

I am comparing two tables "A" and "B" in which I want to compare values of columns with the same meaning, but are written in different ways. The table "A" has the column "Mes_ano" and has values "jan, fev, mar, abr ..." while in table "B" has co...
asked by 25.07.2017 / 01:40
1
answer

Average MYSQL per minute

Hello, in the table below, you have to do a select that returns me the following: select the average current per minute between the day x and day y and that on the return display the day and minutes? I have one record per second in the table,...
asked by 28.06.2017 / 01:51
2
answers

Insert Table ID with 13,346 rows with LOOP

I need to update a table with 13,000 rows. And this table contains a field called "track_cep_id" and all ids are 0. I need to update this with a loop so I do not duplicate the fields (EX: 1, 2, 3, 4 ...). Could someone help? DROP TABLE IF EXIS...
asked by 20.07.2017 / 08:12
1
answer

subquery with 3 different tables using ilike in postgres

Personal I have a question. How do I search for a particular text using ilike to know if this text exists in 3 related tables. I tried to exist but did not give CREATE TABLE metodo ( id SERIAL NOT NULL, descricao CHARACTER VARYING NOT...
asked by 19.07.2017 / 22:36
2
answers

Can I have a settings table without primary key?

In database, this table will be for information storage and will only have one row, which may be updates and initialize null and over the course of the program will be added. Is it possible to have a table without primary key for this function?...
asked by 12.06.2017 / 18:21
1
answer

Know result of count () in query

I have the following query in pdo: $ranking = $pdo->query("SELECT * FROM usuarios GROUP BY moedas ORDER BY count(moedas) DESC LIMIT 3"); I use this to make a ranking to know users with more coins. However, I am using a second query with...
asked by 29.06.2017 / 05:59
1
answer

How to select multiple data from related tables

I have created three tables in the student, book and loan database, I would like to list all the books that were loaned to each student, however, when the student takes more than one borrowed book the command I use to make the search in the bank...
asked by 19.06.2017 / 00:19
1
answer

Can I automatically run a Python program outside my computer?

Good morning, I've done a Python script that searches the various websites for the occurrence of some words and stores them in SQL database. I would like to track the occurrence of these words over time, but I do not want to be left clicking to...
asked by 06.06.2017 / 10:32