Lesson 14
Basic SQL Operations
Table Querying Conclusion
This module has presented all the basic hurdles to using and understanding SQL.
You should understand, play with, and feel comfortable with these statements because you will use them constantly when you work with an SQL database system.
You will be using the SELECT statement in extracting the information needed for the class project. It's the core of most of the work you will be doing with SQL.
It would be a good idea to review this module before continuing. From here, we will build on the SELECT statement and show how you can do more advanced database queries. The balance of the language is built on the INSERT, SELECT, UPDATE, and DELETE statements.
SQL Aliases
SQL aliases are used to give a database table, or a column in a table, a temporary name.
Basically aliases are created to make column names more readable.
SQL Alias Syntax for Columns:
SELECT column_name AS alias_name FROM table_name;
SQL Alias Syntax for Tables:
SELECT column_name(s) FROM table_name AS alias_name;
SQL Commands
The SQL commands described in this module let you perform basic database operations such as determining the database's structure and contents. This chapter explained how to:
- Use the CREATE TABLE statement to create a table with a primary key, indexes, and foreign key constraints.
- Use INSERT statements to add data to a table.
- Use SELECT statements to select data from one or more tables, satisfying specific conditions, and sort the result.
- Use the UPDATE statement to modify the data in a table.
- Use the DELETE statement to remove records from a table.
SQL statements let you perform simple tasks with a database such as creating a new table or inserting a record.
By combining many SQL statements into a script, you can perform elaborate procedures such as creating and initializing a database from scratch.
It describes the benefits of using scripts to create databases and discusses some of the issues that you should understand before writing those scripts.
Different SQL Operations - Quiz