What is SQL?
Applications of SQL
SQL is
one of the most widely used query language over the databases. I'm going to
list few of them here:
·
Allows
users to access data in the relational database management systems.
·
Allows
users to describe the data.
·
Allows
users to define the data in a database and manipulate that data.
·
Allows
to embed within other languages using SQL modules, libraries &
pre-compilers.
·
Allows
users to create and drop databases and tables.
·
Allows
users to create view, stored procedure, functions in a database.
·
Allows
users to set permissions on tables, procedures and views.
SQL Commands
1. DDL - Data Definition
Language
2. DML - Data Manipulation
Language
·
SELECT
·
INSERT
·
UPDATE
·
DELETE
3. DCL - Data Control Language
·
GRANT
·
REVOKE
4. TCL – Transaction Control
Language
- COMMIT
- ROLLBACK
- SAVEPOINT
Data Integrity
The following categories of data integrity exist with each RDBMS −
Entity Integrity − There are no duplicate rows in a table.
Domain Integrity − Enforces valid entries for a given column by restricting the type, the format, or the range of values.
Referential integrity − Rows cannot be deleted, which are used by other records.
User-Defined Integrity − Enforces some specific business rules that do not fall into entity, domain or referential integrity.
SQL Constraints
Constraints are the rules enforced on data columns on a table. These are
used to limit the type of data that can go into a table. This ensures the
accuracy and reliability of the data in the database.
Constraints can either be column level or table level. Column level
constraints are applied only to one column whereas, table level constraints are
applied to the entire table.
Following are some of the most commonly used constraints available in SQL −
• NOT NULL Constraint − Ensures that a column cannot have a NULL
value.
• DEFAULT Constraint − Provides a default value for a column when
none is specified.
• UNIQUE Constraint − Ensures that all the values in a column are
different.
• PRIMARY Key − Uniquely identifies each row/record in a database
table.
• FOREIGN Key − Uniquely identifies a row/record in any another
database table.
• CHECK Constraint − The CHECK constraint ensures that all values in
a column satisfy certain conditions.
No comments:
Post a Comment