Questions tagged as 'sql'

2
answers

Difference between RIGHT JOIN and LEFT JOIN [duplicate]

I have a little knowledge on table relationships, I have read the answers to the question on #
asked by 27.08.2016 / 02:21
1
answer

SQL increasing the ID by 1000 units

I have a database in SQL Express with a reasonable amount of data for more than a year. It has always worked fine, but now it is presenting the following problem: sometimes the ID in some tables ends up increasing by 1000 units. I did a littl...
asked by 14.10.2014 / 19:45
2
answers

Dependencies on the same table

A funeral home asked me to do a simple customer registration scheme for them. A customer can have several dependents who benefit from his or her contracted plan if he or she is killed. I am in doubt as to the data model. I could create two ta...
asked by 13.06.2014 / 15:02
1
answer

If the field has DEFAULT should it be NOT NULL?

Situation I was adding a few more columns to a table and fell out of this thought. By default we leave all fields with NULL value, however if it has a DEFAULT it will insert DEFAULT instead of NULL . Question...
asked by 20.10.2015 / 17:12
1
answer

How to customize the Auto_Increment numbering in MySQL?

I have a Contrato column in my MySQL database, it is as Auto_Increment, numbering the contracts as 1 , 2 , 3 in> ... But I needed, if possible, to organize these numbers in the actual format of contract numbers. It works lik...
asked by 28.02.2015 / 20:37
1
answer

How to make a query that returns data of the last 7 days without considering Sunday

I need some condition in SQL SERVER to return the result of the list of elements taking into account the last 7 days of creation of the same. However he can not consider Sunday as a valid day in the query. Inquiry: Select SearchId, g...
asked by 24.03.2015 / 19:25
1
answer

How to restrict dates in MySQL and SQL Server?

I wonder if I can restrict certain dates in the database itself, not the code. For example, I have a table that records date of entry and date of exit. Here are some requirements. The date of entry can never be greater than the date of ex...
asked by 05.08.2016 / 14:55
1
answer

mysql function do not join the equals

I have this query for MySQL: SELECT email, COUNT(*) AS Vezes FROM automovel GROUP BY email HAVING COUNT(*) ORDER BY 'data_cadastro' ASC It groups all the emails together, and shows how many times they appear. I need to make it just show t...
asked by 08.11.2016 / 21:35
1
answer

Difference between table temporary and table variable

In SQLServer there are table and variable table and variable table features. What would be the most advantageous or best option to put in a procedure that inserts the query that was returned from a SELECT , and can store an average of 2 t...
asked by 24.05.2017 / 13:47
2
answers

What is the use of 'SELECT 1'?

I am making a query using NOT EXISTS in a college job. The situation is as follows: 1.14 - Design the CPF and the amount payable in rents for customers who have rented media and have not yet made any payment. The query performed and...
asked by 02.11.2015 / 00:10