What is SQL?Functions,Commands,Operators
SQL means Structured Query Language it is a programming language designed for managing data in a relational database. IBM first developed SQL in 1970’s. Also it is an ANSI/ISO standard. It has become a Standard Universal Language used by most of the relational database management systems. Structured Query Language has a variety of functions that allows its users to read, manipulate, and change data. Though SQL is commonly used by engineers in software development, it’s also popular with data analysts for a few reasons:
- It’s semantically easy to understand and learn.
- Because it can be used to access large amounts of data directly where it’s stored, analysts don’t have to copy data into other applications.
- Compared to spreadsheet tools, analysis done in SQL is easy to audit and replicate. For analysts, this means no more looking for the cell with the typo in the formula.
Structured Query Language is great for performing the types of aggregations that you might normally do in an Excel pivot table—sums, counts, minimums and maximums, etc.—but over much larger datasets and on multiple tables at the same time.
Functions of SQL
- Store data
- Modify data
- Retrieve data
- Delete data
- Create tables and other database objects
- Detect data
SELECT: it extracts data from a database.
UPDATE: it updates data in database.
DELETE: it deletes data from database.
CREATE TABLE: it creates a new table.
ALTER TABLE: it is used to modify the table.
DROP TABLE: it deletes a table.
CREATE DATABASE: it creates a new database.
ALTER DATABASE: It is used to modify a database.
INSERT INTO: it inserts new data into a database.
CREATE INDEX: it is used to create an index (search key).
DROP INDEX: it deletes an index.
There are three types of operators in SQL
- SQL Arithmetic Operators
- SQL Comparison Operators
- SQL Logical Operators
SQL Arithmetic Operators
|+||It is used to add containing values of both operands|
|–||It subtracts right hand operand from left hand operand|
|*||It multiply both operand?s values|
|/||It divides left hand operand by right hand operand|
|%||It divides left hand operand by right hand operand and returns reminder|
SQL Comparison Operators
|=||Examine both operands value that are equal or not,if yes condition become true.|
|!=||This is used to check the value of both operands equal or not,if not condition become true.|
|< >||Examines the operand?s value equal or not, if values are not equal condition is true|
|>||Examine the left operand value is greater than right Operand, if yes condition becomes true|
|<||Examines the left operand value is less than right Operand, if yes condition becomes true|
|>=||Examines that the value of left operand is greater than or equal to the value of right operand or not,if yes condition become true|
|<=||Examines that the value of left operand is less than or equal to the value of right operand or not, if yes condition becomes true|
|!<||Examines that the left operand value is not less than the right operand value|
|!>||Examines that the value of left operand is not greater than the value of right operand|
SQL Logical Operators
|ALL||This is used to compare a value to all values in another value set.|
|AND||This operator allows the existence of multiple conditions in an SQL statement.|
|ANY||It is used to compare the value in list according to the condition.|
|BETWEEN||It is used to search for values, that are within a set of values|
|IN||It is used to compare a value to that specified list value|
|NOT||The NOT operator reverse the meaning of any logical operator|
|OR||This operator is used to combine multiple conditions in SQL statements|
|EXISTS||The EXISTS operator is used to search for the presence of a row in a specified table|
|LIKE||This operator is used to compare a value to similar values using wildcard operator|