loading..
Русский    English
21:57

Exercise #6 (tips and solutions)

There are two ways to perform a table join (in this case, an inner join is needed):

1. Using a WHERE clause (the only option before the SQL-92 standard has been introduced)

Console
Execute
  1. SELECT DISTINCT Product.maker, Laptop.speed
  2. FROM Product, Laptop
  3. WHERE Product.model = Laptop.model
  4. AND Laptop.hd >= 10;

2. Explicit use of a JOIN statement

Console
Execute
  1. SELECT DISTINCT Product.maker,Laptop.speed
  2. FROM Product JOIN
  3. Laptop ON Product.model = Laptop.model
  4. WHERE Laptop.hd >= 10;

Although the  A database management system (DBMS) by Microsoft Corporation. SQL(Structured Query Language) is a database computer language designed for the retrieval and management of data in relational database management systems (RDBMS), database schema creation and modification, and database object access control management.SQL Server query optimizer will generate identical execution plans for both queries, the second alternative is preferable, since it allows to keep apart join conditions and row filtering criteria.

Return to discussion of exercise #6

Solve this task at SQL-EX.RU

Bookmark and Share
Tags
aggregate functions Airport ALL AND AS keyword ASCII AVG Battles Bezhaev Bismarck C.J.Date calculated columns Cartesian product CASE cast CHAR CHARINDEX Chebykin check constraint classes COALESCE common table expressions comparison predicates Computer firm CONSTRAINT CONVERT correlated subqueries COUNT CROSS APPLY CTE data type conversion data types database schema DATEADD DATEDIFF DATENAME DATEPART DATETIME date_time functions DDL DEFAULT DEFAULT VALUES DELETE DISTINCT DML duplicates edge equi-join EXCEPT exercise (-2) More tags
The book was updated
month ago
©SQL-EX,2008 [Evolution] [Feedback] [About] [Links] [Team]
All right reserved.