SQL Query Design

It is important design any queries that needs to be implemented.

The query design does not need to include specific SQL (Structured Query Language) commands. SQL commands will only be used during implementation

At the design stage, it is only necessary to state the following:

  • fields
  • tables
  • criteria
  • sort order

Short hand can be used for the terms Ascending (ASC) and Descending (DESC).

Below is a few examples to help you design your own queries

 

 

 

 

 

Example 1

Design a query to show all records from the Films table where the Rating is equal to ‘U’.

 

 

 

 

Example 2

Design a query to show the Title, Rating and Genre all records from the Films table where the Distributor is equal to ‘20 Century Fox’.

 

 

 

 

Example 3

Design a query to show Title and Running Time from the Films table for films where the Rating is equal to ‘U’ or ‘PG’, sort by Title Ascending Order.