Introduction to SQL

SQL (Structured Query Language) is the standard language for creating, updating, querying, and deleting information in databases. SQL is an ANSI (American National Standards Institute) standard language that is adopted in most database systems.  These database systems are RDBMS (Relational Database Management System) based and the primary object for storing data is the table.

RDBMS tables

In a RDBMS database data is organized and stored in tables. Tables contain field names which make up the columns and also records which make up the rows.  Typically the data in each table is related to a single entity such as Customer, Product, Employee, Orders, etc. The tables can contain a primary key, which is a field that is unique in that table and separates a record from all others. Below is an example of a table with the customer_id field being a primary key and the database containing four records.

customer_id first_name last_name gender
 1267  Clara  Oswald  F
 1268  Rose  Tyler  F
 1269  Amy  Pond  F
 1270  Rory  Williams  M

Popular database systems

You can find powerful database systems in both proprietary and open source variants. Over the last few years, the most popular database engines include Oracle, MySQL, and Microsoft’s SQL Server. The Oracle database system is the most popular RDBMS on the market today and it is a proprietary database. MySQL is the leading open source database engine and is also maintained by Oracle. Microsoft’s powerful database engine is SQL Server and is also highly used by companies.

Although many of the database systems have graphical tools to allow you to create databases and tables, the entire database and tables can be created using SQL statements, which translate between database engines. In this course we will be focusing on using the SQL language to create databases and not just the graphical tools. The SQL commands can be used regardless of database system. They can also be used in conjunction with other programming languages such as PHP and ASP to work with web sites.