Exercises

1. 

Which of these will sort records in a query?

  1. ORDER BY

  2. WHERE

  3. SELECT

  4. FROM

  5. None of the above

image from book

2. 

What will the statement SELECT * FROM CUSTOMER find?

  1. All records in the CUSTOMER table

  2. The first record in the CUSTOMER table

  3. The last two records in the CUSTOMER table

  4. All fields in the CUSTOMER table

  5. All records and all fields in the CUSTOMER table

image from book

3. 

Which of these statements can be used to make changes to data in a database?

  1. UPDATE

  2. SELECT * FROM ...

  3. CREATE TABLE

  4. ALTER TABLE

  5. INSERT

  6. All but b.

image from book

4. 

How many tables will this query retrieve records from?

   SELECT * FROM TABLE1 CROSS JOIN    INNER JOIN TABLE2 USING (ID1)       CROSS JOIN TABLE3          LEFT OUTER JOIN TABLE4 USING (ID2);   
  1. 1

  2. 2

  3. 3

  4. 4

  5. 5

image from book

Answers

1.  

Exercise 1 solution

e. ORDER BY . The ORDER BY clause is added to the end of a query SELECT statement to re-sort records after the WHERE and GROUP BY clauses have been applied to the selected records.

2.  

Exercise 2 solution

e. All records and all fields in the CUSTOMER table. The * (asterisk or star character) means that all fields are retrieved from a table. The lack of a WHERE clause filter or a GROUP BY clause summary means that all records are retrieved. In other words, all the data contents of the entire table are retrieved.

3.  

Exercise 3 solution

f. All but b. Answer f is correct because b is a query that retrieves data from a database. The UPDATE statement changes records in a table. The CREATE TABLE statement creates a new table. The ALTER TABLE changes an existing table. The INSERT statement adds records to a table.

4.  

Exercise 4 solution

d. 4. Answer d is correct because there are three JOIN clauses and four tables shown in the query.



Beginning XML Databases
Beginning XML Databases (Wrox Beginning Guides)
ISBN: 0471791202
EAN: 2147483647
Year: 2006
Pages: 183
Authors: Gavin Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net