Section 4.2 SQL Fundamentals
Learning Objectives
After you have completed this section, you should be able to
- write database queries in structured query language (SQL).
Activities
- Carefully read the learning objectives.
- Watch related section of the presentation for Chapter 18;
- Read section 18.4, SQL of Chapter 18.
- Study the tutorial at http://www.dcs.napier.ac.uk/~andrew/sql/.
- Find answers to the study questions below.
- Design a database called “books” for a library. It should have at least two tables: book and borrower.
- Write an SQL file that can be used to create the above two tables.
Study Questions
- What commands does SQL provide?
- What can you do with the SELECT query command?
- How do you use the SELECT query command?
- What should directly follow the SELECT keyword?
- What should directly follow the FROM keyword in a SELECT query command?
- When do you need to use the WHERE clause in a SELECT query? How do you use it?
- When do you need to use the GROUP BY clause in a SELECT query?
- What does the COUNT(*) AS count clause do?
- When do you need to use the ORDER BY clause in a SELECT query?
- How do you merge data from multiple tables using the SELECT query?
- How do you insert a record into a table using the INSERT INTO command?
- How do you modify data in a table using the UPDATE command?
- How do you remove data from a table using the DELETE FROM command?
Updated April 14 2016 by FST Course Production Staff