SQL: Structured Query Language, lets you access or modify databases. SQL can execute queries, retrieve data, insert records, update records, delete records, create a new database, create new tables, create views, and set permissions on tables, procedures, or views.
Operator | Meaning |
---|---|
SELECT | Selects columns from a relation or set of relations. It defines WHAT is to be returned. Note: As opposed to Relational Algebra, it may give duplicate tuples for the repeated values of an attribute. |
FROM | FROM is used to define the Table(s) or View(s) used by the SELECT or WHERE statements |
WHERE | WHERE is used to define what records are to be included in the query. It uses conditional operators. |
EXISTS | EXISTS is used to check whether the result of a correlated nested query is empty (contains no tuples) or not. |
GROUP BY | GROUP BY is used to group the tuples based on some attribute or set of attributes like counting the number of students GROUP BY the department. |
ORDER BY | ORDER BY is used to sort the fetched data in either ascending or descending according to one or more columns. |
Aggregate functions | Find the aggregated value of an attribute. Used mostly with GROUP BY. e.g.; count, sum, min max. select count(*) from the student group by dept_idNote: we can select only those columns which are part of GROUP BY. |
Nested Queries | When one query is a part of another query. |
UPDATE | It is used to update records in a table. |
DELETE | It is used to delete rows in a table. |
LIKE | LIKE operator is used with the WHERE clause to search a specified pattern in a column. |
IN | IN operator is used to specify multiple values in the WHERE clause. |
BETWEEN | It selects values within a range. |
Aliases | It is used to temporarily rename a table or a column heading. |
HAVING | The HAVING clause was added because the WHERE keyword could be used with aggregate functions. |