What is SQL ? and clauses in SQL

 What is SQL?

SQL (Structured query language) is a programming language designed for managing data from relational database. SQL has variety of functions that allows user to read, manipulate and change data .though SQL is commonly used by engineers in software development. It’s also popular with data analysts for few reasons:

· SQL is easy to understand and learn.

· It can be used to access large amounts of data directly where it stored. Analysts do not have to copy into other applications

· Compared to spreadsheet tools, data analysis done in SQL is easy to audit and replicate. For analysts, this means no more looking for the cells with the type in the formula.

What Can SQL do?

· SQL can execute queries against a database, retrieve data from a database, insert records in a database, update records in a database, delete records from a database, SQL can create new databases, create new tables in a database, create stored procedures in a database, create views in a database, set permissions on tables, procedures, and views

 

SQL is a Standard ?

SQL is an ANSI/ISO standard, there are different versions of the SQL language.

 all versions support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner to be compliant with ANSI standards.

 

Keep in mind

SQL keywords are NOT case sensitive: select is the same as SELECT

 

· 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

Syntax

1.SELECT * Example

 The following SQL statement selects all the columns from the “Sales” table.

Example:

SELECT* FROM Sales;

2.SELECT columns wise 

The following SQL statement access selected columns from the “Sales” table.

Example:

SELECT year,

              Month,

  West

FROM Sales;

3. Rename Columns 

The following SQL statement rename column from the “Sales” table.

Example:

SELECT west AS “west Region”

FROM Sales;

4. The LIMIT clause

 The LIMIT clause is used to specify the number of records from “Sales” table

Example:

SELECT*

FROM Sales

LIMIT 100;

5. WHERE Clause

 The WHERE clause is use to filter records. Used to extract only those records that fulfil a specified condition.

Example:

SELECT*

FROM Sales

WHERE Country = “Canada”;