Questions tagged as 'sql'

2
answers

Difference in use Index Unique and Unique Constraint in Sql Server?

I would like to know what behavior / differences between a Unique Index and Unique Constraints for Sql Server ? Many should think that this does not make a difference in the database, but it does! And not only for the DBA / Administrator...
asked by 21.12.2013 / 21:37
5
answers

How do I join two results of a query?

I'm developing an application in C # and would like to know how to merge two results from two queries into one. I have the following code: public List<MalaDireta> ObterMalaDireta() { List<MalaDireta> resultado = new List&...
asked by 11.12.2013 / 17:08
2
answers

Difference between CROSS APPLY and OUTER APPLY?

What is the difference between CROSS APPLY and OUTER APPLY ? How do they work? In what situation can they be used? Would it be possible to show some examples?     
asked by 23.04.2014 / 18:38
3
answers

Is a subquery in the SELECT calculated for each of the results or only once?

Based on this example, where the result will be used to calculate the percentage of occurrence of each 'type' , which approach is more efficient / faster? Use a subquery in SELECT to calculate total records: SELECT tipo, COUNT(*) AS Par...
asked by 08.05.2015 / 17:30
2
answers

What is the difference between clustered index and nonclustered index?

Studying about found a example , and about clustered says:    Primary Keys by default use a clustered index, that is, when performing a select * from myTable where IDColumn = 1 query, the database will perform a binary search to f...
asked by 17.04.2017 / 18:45
3
answers

How to find a String from Regular Expressions

I have a field in the SQL Server 2014 database that stores the client address. The problem is that everything was stored in a single varchar field. Here are some real examples:    Antonio José Nerchis Street, 81    Street: Guaira /...
asked by 31.08.2016 / 20:09
3
answers

Subqueries can decrease performance? Myth or truth?

Well, I usually only work with frameworks . I work with frameworks MVC and I usually use the ORMs to query the database. In my case I use Laravel, but I've used other frameworks , and had the recent opportunity to get to know the Entity F...
asked by 01.07.2016 / 21:37
6
answers

How to get distance given the coordinates using SQL?

I'm making a function in php , in which, given a GPS coordinate, it will search the database for registered locations, which are not necessarily fixed, within a certain distance. My question is: how do I calculate the distance between the co...
asked by 13.03.2014 / 13:19
4
answers

Do I really need to define constraints in the database?

Ruby on Rails seems to have been thought of since it is not necessary to define constraints (like Foreign Keys ) in the database, / p> Normally the only constraint that is created in this case is the primary key of the id column, o...
asked by 13.05.2014 / 20:30
3
answers

What is SQL? How to use?

I already know at least that SQL is related to the database, with the query of values in the database. But it is not clear what would be the SQL. What would you use this resource for? And how do you use SQL, for example in a user system?  ...
asked by 28.06.2014 / 03:44