Classic Movies and Books

Learn Software Development

All about the processes involved in software development

Search this site
Google
 

Structured Query Language (SQL)

Filed Under Databases, Language, SQL | Posted on September 9, 2009




The structured query language (SQL) is the language used to query and manipulate information within a SQL Server database. SQL is actually an ISO and ANSI standardised language. However, a lot of RDBMS software use their own proprietary extensions within their own Transact-SQL (T-SQL) variant of SQL.

The basic building block of the structured query language is the SQL statement. Using statements, information in a database can be manipulated and queried.
* CREATE – a data structure.
* SELECT – read one or more rows from a table.
* INSERT – one or more rows into a table.
* DELETE – one or more rows from a table.
* UPDATE – change the column values in a row.
* DROP – a data structure.

Language Structure :
SQL is a keyword based language. Each statement begins with a unique keyword. SQL statements consist of clauses which begin with a keyword. SQL syntax is not case sensitive.
The other lexical elements of SQL statements are:
* names — names of database elements: tables, columns, views, users, schemas; names must begin with a letter (a – z) and may contain digits (0 – 9) and underscore (_)
* literals — quoted strings, numeric values, date time values.
* delimiters — + – , ( ) = < > <= >= <> . * / || ? ;
Basic database objects (tables, views) can optionally be qualified by schema name. A dot — “.”, separates qualifiers: schema-name . table-name
Column names can be qualified by table name with optional schema qualification.

Syntax of Simple SELECT : SELECT column FROM tablename
- Using “Where”
SELECT EMPLOYEEIDNO
FROM EMPLOYEESTATISTICSTABLE
WHERE SALARY >= 50000;
- Compound Conditions
SELECT EMPLOYEEIDNO
FROM EMPLOYEESTATISTICSTABLE
WHERE SALARY < 40000 OR BENEFITS < 10000;
- Using “IN”
SELECT EMPLOYEEIDNO
FROM EMPLOYEESTATISTICSTABLE
WHERE POSITION IN (‘Manager’, ‘Staff’);
- Using “Between”
SELECT EMPLOYEEIDNO
FROM EMPLOYEESTATISTICSTABLE
WHERE SALARY BETWEEN 30000 AND 50000;
- Using “LIKE”
SELECT EMPLOYEEIDNO
FROM EMPLOYEEADDRESSTABLE
WHERE LASTNAME LIKE ‘L%’;



| More

If you are interested in software processes, find this post informative, and want to learn more, why not subscribe ?
Subscribe in a reader
Subscribe to get updates by Email

Leave a Reply





Bad Behavior has blocked 194 access attempts in the last 7 days.