SQL Syntax
Most of the actions perform on a database are done with SQL statements. Select all records from the Employee table:
It consists of keywords that are easy to understand.
Example:
SELECT * FROM `employee`;
Database Tables
A database contains one or more tables. Each table is identified by a name (e.g. "Employees" or "Orders"), and
contain records (rows) with data.
Below is a selection from the Employee table used in the examples:
The table contains six records (one for each employee)
and six columns (Employee_id, Employee_name, Address, City, Pincode, and Country).
SQL Commands
- 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
Semicolon after SQL Statements?
Some database systems require a semicolon at the end of each statement.
Semicolon is use to separate statement in database systems which allow more than
one SQL statement to be executed in the same call to the server.