Saturday, October 8, 2016

SQL Syntax

SQL is followed by unique set of rules and guidelines called Syntax.

SQL Statements


Most of the actions you need to perform on a database are done with SQL Statments.
SQL was designed to be entered on a console and results would display back to a screen.


SELECT * FROM TableName;

Example:

SELECT * FROM Employee;

Important SQL Commands


SELECT                           -     Read the data.
INSERT INTO                 -     Insert or Add new data.
UPDATE                          -     Update existing data.
DELETE                          -     Remove or Delete data.
CREATE DATABASE    -     Create new database.
DROP TABLE                -      Deletes a table.
CREATE INDEX            -     Create an index.
ALTER DATABASE      -      Modifies or Edit database.
CREATE TABLE           -      Create a  new table.
ALTER TABLE              -      Modifies or Edit table.
DROP INDEX                -      Remove or Delete index.

SQL Keyword are not case sensitive and some database systems required a semicolon at end of each SQL statement.


Database Tables


A database contains one or more tables.Each table is assigned with unique name.
Below is selection from the "Employee" table.

Employee Table
Employee Table

The table above contains four records and four cloumns (EmployeeId, EmployeeName, Address, Salary).

No comments:

Post a Comment