Title: Structured Query Language (SQL)
Course: CPS 120: Introduction to Computer Science ~ Master (Aug/2015) OLD > Section: Learning Units

Structured Query Language (SQL)

SQL is the language used to communicate with a database.

SQL may be:

- Used to directly interact with a database.
- Embedded within a programming lanugage to communicate with a database.
- Used indirectly within a database management system.

SQL Includes the following statements/commands:

- SELECT - retrieve information from one or more tabes.
  - Ex: SELECT <columns> FROM <table>
- INSERT INTO - add information to a table
  - Ex: INSERT INTO <table> (<columns>) VALUES (<values>)
- UPDATE - change information in a table
  - Ex: UPDATE <table> SET <column> = <value> WHERE <column> = <value>
- DELETE FROM - remove information from a file
  - Ex: DELETE From <table> WHERE <column> = <value>

SQL Practice

Practice your SQL at www.w3schools.com/sql/.

Try some of these SQL statements:

- SELECT * FROM Customers;
- SELECT CustomerName, ContactName FROM Customers;
- SELECT * FROM Customers WHERE City='London';
- SELECT * FROM Employees;
- SELECT * FROM Employees WHERE FirstName LIKE 'M%';
- SELECT * FROM Products;
- SELECT ProductName, Unit, Price FROM Products;
- SELECT ProductName, Price FROM Products WHERE Price >= 20;