Thank this author by sharing:
By Steve Jones, 2001/06/22
I provided some SQL questions for an interviewer in Who Do You Hire? to ask of a candidate. I had a couple requests for answers, so I decided to provide some. I would recommend you check the questions first before you read these.
select o.orderid from orders o where o.custid = ( select o1.custid from orders o1 where o1.qty > 1 and o1.orderid = o.orderid )
select distinct c.name, o.orderid from customers c, orders o where c.custid = o.custid
select c.name, o.orderid, count(o.orderid) from customers c, orders o where c.custid = o.custid group by c.name, o.orderid having count( o.orderid) > 1
Normalization is a technique for storing data in a relational database system. There are various levels or normalization, but when most people speak of Normalization, they are referring to third normal form. Under this level, there are no repeating data elements, fields depend on the complete primary key, and no dependencies on non-key columns. Also no derived columns.
Usually third normal form reduces the amount of data storage needed as well as makes OLTP applications quicker by reducing the amount of data necessary for an insert.
Denormalization is often done to reduce the number of joins required for a query. Usually in OLAP applications.
index
Query that is ran uses different indexes, Why?
Determining how, and if, SQL Server is using your indexes.
always use incorrect index to run the query by sql server
SQL Server Index
As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.
Join us!
Steve Jones Editor, SQLServerCentral.com