Reviewing SQL Concepts
Reviewing SQL Concepts
*The table above contains five records (one for each customer) and seven columns (CustomerID, CustomerName,
ContactName, Address, City, PostalCode, and Country).
SQL Statements
Most of the actions you need to perform on a
database are done with SQL statements.
The following SQL statement selects all the
records in the "Customers" table:
SQL keywords are NOT case sensitive: select is the same as SELECT
Semicolon after SQL Statements?
• SELECT - extracts data from a database
• UPDATE - updates data in a database
• DELETE - deletes data from a database
• INSERT INTO - inserts new data into a database
• CREATE DATABASE - creates a new database
• ALTER DATABASE - modifies a database
• CREATE TABLE - creates a new table
• ALTER TABLE - modifies a table
• DROP TABLE - deletes a table
• CREATE INDEX - creates an index (search key)
• DROP INDEX - deletes an index
SQL SELECT Statement
The SELECT statement is used to select data
from a database.
The data returned is stored in a result table,
called the result-set.
SELECT Syntax
Here, column1, column2, ... are the field names
of the table you want to select data from. If
SELECT column1, column2, ... you want to select all the fields available in the
FROM table_name; table, use the following syntax:
SELECT * Example
The following SQL statement selects all the columns from the "Customers" table:
WHERE Syntax
SELECT column1, column2, ... Example:
FROM table_name SELECT * FROM Customers
WHERE condition; WHERE Country='Mexico';