Questions tagged as 'sql'

2
answers

Correct Code to select and compare

I want to select * from table A that are different from table B and I have used the following code: select * from Tabela A inner join Tabela B on A1 != B1 and A2 != B2 and A3 != B3 But the computer's memory goes to the limit and blocks the...
asked by 26.02.2018 / 12:45
2
answers

Search for the last 24h lines that repeat the most (MySQL)

'SELECT 'from', 'to', count(*) AS num_clicks FROM my_rank WHERE my_rank_data BETWEEN "'.$yesterday.'" AND "'.$today.'" ORDER BY num_clicks DESC LIMIT 0,20'; Above I'm trying to get the "from" and "to" fields from a table, but I only want the l...
asked by 22.02.2018 / 02:15
1
answer

How do I sort a date field in mysql?

How do I sort a date field entered by the datepicker script in the format dd-mm-yyyy in Mysql? Note: Dates are being sorted only by day, ignoring the next month and year. And the date field is of type varchar (10). Ex: 02-05-2018 (dd-mm-...
asked by 02.05.2018 / 15:28
2
answers

Give an insert in a table with information from two tables

I would like to know how to insert two ids into two tables. For example, there are 5 tables one is a student, which has the following information: +--------+------------+ | ID_ALU | nome | +--------+------------+ | 1 | aluno 1 |...
asked by 03.05.2018 / 15:11
2
answers

Replace the second repeated character

I have the following value in an Oracle query. SELECT '3.0.' FROM DUAL I would like it to return only 3.0 and remove the Last Point (.) I tried using REGEXP_REPLACE like this: SELECT REGEXP_REPLACE('3.0.','(.){2,.}','') FROM DUAL...
asked by 15.02.2018 / 16:01
1
answer

SQL SERVER - return different columns of an inner join on the same row

I have the following scenario: Users table Table users access In the usuariosacessos table, each row has the id of the user, the name of the feature, and a field stating whether or not you have access. In my specifi...
asked by 14.03.2018 / 00:29
1
answer

Execute query from select + update SQL

I have the following SQL: SELECT prospect.uni_id, prospect.usu_id, prospect.pro_nome, prospect_agendamento.* FROM prospect_agendamento JOIN prospect ON(prospect.pro_id=prospect_agendamento.age_id_prospect) WHERE prospect_agendamento.age_cod_co...
asked by 19.02.2018 / 01:11
2
answers

How to relate multiple tables?

Below I put an example that I did in excel. How does a select change the values of the inf_musicas table by the value of the other corresponding tables? NOTE: I know the basics of SQL, I know it uses inner JOIN or it can...
asked by 15.02.2018 / 18:19
1
answer

Reset AUTO INCREMENT and organize item IDs [duplicate]

What command can I use to rearrange the ID of all items in a table? The name of the table is produtos and the column is id . Currently they look like this: id: 1 - 3 - 7 - 8 - 9 - 11 ... That is, they are not in the...
asked by 19.04.2018 / 23:54
2
answers

How is a multivalued attribute represented?

I need to do a Google Play modeling as a university job, one of the requirements of the job is to represent a multivalued one. how would that be represented? Was it a guy? ex: Nome Tipo Genero Set Is Set a Multivalued? If you can use...
asked by 19.04.2018 / 17:36