Questions tagged as 'sql'

3
answers

What are the appropriate data types for columns like address, email, phone, and mobile for SQL database?

What kind of data is recommended to create the following fields: address, email, cell / phone number?     
asked by 04.02.2014 / 20:13
3
answers

Select first record within a segmentation in SQL Server

I have the following example table: The query asks me to show which students entered first in each course. I can tell which student entered the university first, using the top(1) function, but how can I do this for each course?...
asked by 29.08.2017 / 16:48
1
answer

How do I SELECT on 2 or more Tables with 2 or more conditions?

I have a problem making a select with the following conditions: I want to display the data with either condition1 or condition2 Select * tabela inner join tabela2 WHERE campo = 0 and campo2 = '' and campo3 or campo10 is NULL Select all the...
asked by 11.03.2014 / 11:14
3
answers

SQL command to display specific records of the "id" field

What SQL statement would display the records where the id field was 22, 23, 25 and 27?     
asked by 30.08.2014 / 02:21
2
answers

How do I search for records saved in the current week?

I'm doing a query on a database, and I want to list the records for the current week. It would be something based on the question about fetching data from the last 7 days from the current date , but instead from the current date, would be the s...
asked by 25.01.2017 / 17:51
2
answers

What is data persistence?

What would this term be? I always see around and I can not decipher!     
asked by 13.07.2016 / 13:32
1
answer

Left Join or Not Exists

I needed to retrieve information that was in one table, but not in another. Searching found that NOT EXISTS would serve this purpose, but I saw that the Left Join has the same result: NOT EXISTS select pedido from logintegracao as A where...
asked by 09.12.2015 / 19:11
3
answers

How to rename the SQL Table column

I want to rename the column via SQL. I'm trying this way: ALTER TABLE nomes_clientes RENAME COLUMN primeiro_nome TO nome, RENAME COLUMN segundo_nome TO sobrenome; But that way it is not working.     
asked by 08.09.2017 / 18:56
2
answers

Smart query with MySQL

I'm trying to make a more "smart" query in my DB, My question is how? I have a query : SELECT * from publicacao where titulo like '%$busca%'; and in my DB there are several publishing titles, for example: Farmácia Pharmácia Pharmacia...
asked by 22.11.2016 / 19:22
2
answers

What is the purpose of the = operator in MySQL?

SELECT * FROM 'client' WHERE avatar <=> NULL This returned the only two items you have in the database, both for <=> and = . Another test I did was with <=> , which returns all items that the =...
asked by 09.06.2017 / 21:46