SQL or Structured Query Language is a unique programming language designed mainly for managing the data stored in a Relational DataBase Management system or RDBMS. SQL is a an interactive and programming language which facilitates collecting information from a database and updating the database.
RDBMS Concepts: What is RDBMS
The database management system based on relational model introduced by E. F. Codd is called as Relational DataBase Management System and it is the basis for all modern database systems such as SQL, MS SQL Server, IBM, DB2, Oracle, MySQL, Microsoft Access.
What is Table
The object where the data in RDBMS database is stored is called as a table. It contains columns and rows and consists of a pool of related data. This is the simplest and most common form of data storage in a RDBMS database.
What is Field
Tables are divided into smaller entities called as fields. Each field is a column which contains a specific or similar type of data.
What is Row
Each individual entry in a table is called as a row of data or record.
What is Column
A column is a vertical entity that contains information related to a specific field in the table.
What is NULL Value
Value in a field in the table which appears to be blank is called as NULL value. In other words, a field with NULL value is a field with no value. Most important thing to note here is that a field with NULL value is totally different from a field with zero value and from the fields that contains spaces. NULL value field is the one which is kept blank while creating a record.
Rules enforced on data columns in a table are called as constraints. These rules are meant for limiting the type of data that can be entered into a table. Thus, it guarantees the reliability and accuracy of the data inside the database. These constraints can be at column level where the limitation will be only on column level or it can be up to table level where the rules are applied on the entire table.
Commonly used SQL Constraints
- Not NULL constraint to ensure that the column cannot have NULL value
- DEFAULT Constraint for providing a default value for column when no value has been specified.
- UNIQUE Constraint to ensure that all values in column are different
- Primary Key to uniquely identifying each row in a table.
- Foreign Key to uniquely identifying each row in any other database table
- CHECK Constraint to ensure that all values in the column satisfy prescribed conditions
- INDEX to create and retrieve data from the database quickly.