Structured Query Language
Structured Query Language
Constraints In SQL
constraints are used to specify rules for the data in a table.
Commonly used constraints are:
MySql Commands
CREATE Database: Used to create a new database.
CREATE Table:
column2 datatype,
……..
columnN datatype,
Constraint ChkAge
Check(Age>18));
ALTER Tables:
INSERT INTO:
SELECT Command:
WHERE <condition>;
Mathematical: +, -, *, /
LIKE OPERATOR
The LIKE keyword selects the rows having column values that
matches with the wildcard pattern.
Update Command
Aggregate Functions :
MySql supports the following aggregate/multiple row functions:
Result: 80000
Result: 26666.6666
Result: 32000
Result: 3
Result: 5
GROUP BY:
•GROUP BY clause combines all those records that have identical
values in a particular field or a group of fields.
HAVING Clause:
HAVING clause is used to apply conditions on groups in contrast to
WHERE clause which is used to apply conditions on individual
rows.
JOIN:
A JOIN clause combines rows from two or more tables. In a join
query, more then one table are listed in FORM clause.
•Equi-join
•Natural join
Or
The Equi Join and Natural join are equivalent except that duplicate
columns are eliminated in the Natural Join that would otherwise
appear in Equi Join.