Questions tagged as 'sql'

2
answers

Define roles for users stored in Bank

How to structure a user roles structure (common users, businessperson, site_amdin) in the database, each user will have different functions, powers in the application that will use this database. User table: CREATE TABLE users ( id INT...
asked by 15.07.2015 / 14:49
1
answer

How do I display my highest code for each species?

I'm trying the following way (exercise link: SQL Teaching - GROUP BY )    SELECT * FROM friends_of_pickles GROUP BY species; Table: 1 Dave male human 180 2 Mary female human 160 3 Fry male cat 30 4 Leela female cat 25 5 Odie...
asked by 08.09.2015 / 21:57
2
answers

NULL value in database x performance

I have always used a MySQL database for small projects and I never cared about the option "NULL when it is empty", that is, it was blank. Now I'm designing a large system, I would like to know the concept of using NULL value when the f...
asked by 21.10.2015 / 19:31
2
answers

What is position in SQLServer?

I have a question. I received the layout of a table which consists of: Nome do campo | Tamanho | Posição | Tipo The Position contains: De | Até And one of the fields is: Histórico ( no caso da Posição ): 35 | 104 What exactly is...
asked by 15.10.2015 / 17:12
1
answer

Why is it mandatory to use the ';' in the WITH clause?

I've always used WITH in my queries, however, I've never understood exactly why '; ' before the WITH clause is required. The error is very succinct, but gives an idea that WITH requires the previous statement to be clos...
asked by 27.10.2017 / 14:11
1
answer

Insert into the database by recording in half

I get the name of the news and insert it in another table, but one of the fields is going in half, follow the image of print : Database Sourcecodewhereyousend:<inputname="nomenoticia" type="hidden" id="nomenoticia" value="PC realiz...
asked by 15.03.2015 / 19:29
3
answers

How to put zero or null in a SQL query of a date range, for those whose value does not exist?

Formulate the question was a bit difficult, but I'll try to be as explicit as possible using an example to set the question straight. There are the following data in my table: Thepurposeistoexecuteaquerysql(theDBMSusedisMySQL)inthedaterang...
asked by 25.09.2014 / 13:36
1
answer

Procedure with IF NOT EXISTS

Hello stackoverflow developers, I started to delve into sql commands a short time ago, I'm having some kind of syntax error with this procedure, but for a number of attempts, I could not fix it, follow the code there, I'd be very grateful if can...
asked by 29.09.2014 / 01:10
3
answers

Telephone fields and CPF in SQL?

I'm doubtful what kind of variable to create for the CPF and Phone fields in the database, they should be saved like this: (34) 9652-5214 134.124.214-47 With nchar would not complicate the search? But in the case of the nchar, how d...
asked by 03.07.2015 / 22:05
1
answer

Could you add a UNIQUE field that accepts nulls?

Can I create a field that accepts nulls and say that it is unique? This my table, the CRM indicates that it is a doctor and not a normal person, it has to be unique, but it has to allow for nulls. This field is also a foreign key in another t...
asked by 05.03.2015 / 19:40