SQL (Structured Query Language) is a standard language for accessing and manipulating databases. There are three types of SQL languages for relational databases. These are:
• Data Definition Language
• Data Manipulation Language
• Data Control Language
Data Definition Language:-
Data Definition Language (DDL) is a computer language for defining different data structures. DDL statements create, modify and remove data objects such as tables. Some important tasks of DDL are:
• To create objects in a database model
• To alter the structure of the database
• To delete objects from the database
Data Manipulation Language:-
Data Manipulation Language (DML) statements are used to manage or manipulate data, Some examples of DML tasks are:
• To retrieve data from a database o To insert data into a table
• To update existing data within a table o To delete records from a table.
Data Control Language:-
Data Control Language (DCL) is used for controlling the data. A user can access the data based on the privileges given to him. Some important tasks of DCL are:
• To allow specified users to perform specific tasks
• To disallow specified users from performing specified tasks
• To cancel previously granted or denied permissions
BASIC DATABASE TERMINOLOGIES:-
An effective DBMS provides users with timely, accurate and relevant information. This information is stored in computer files, which needs to be suitably organized and proper maintained so that users can easily access the information they need.
The following are some important terms used in database.
A database table is a file that contains data about a single entity. An entity can be a person, place or event, etc. For example ‘Student, “Teacher, Stock, etc. are entities. A database table is composed of rows and columns. Rows hold the records and columns hold the fields. Data item is inserted at each row and Column intersection. Tables are also called relations in RDBMS.
Each table in a database holds data about a different but related subject.
A collection of related fields treated as a single unit is called a record. All the information about one person or item is held in a record. When records are stored in a table, rows represent records and columns represent fields. In relational database rows are also known as tuples. Database table has five records, represented row wise, about the entity ‘Student.
field or attribute is part of a record and contains a single piece of data for the subject of the cord.
Roll No. Used to assign a unique roll number to a student.
Name Used to give name of the student
Class Used to give class of the student
Section Used to store the section of the student
Date Of Birth Used to give date of birth of the student
Address Used to give the address of the student
Fields appear as Columns in a database table.
A file is a collection of records. For example a stock file contains records for items of stock payroll file contains records for employees and so on. In a relational database records are st in files called tables/relations.
It is made up of rows and columns. It may display information that is restricted to a
of table. It may also present selected data from several tables simultaneously. View cannot ex independently of tables.
Every field in a table is assigned a data type. Data types available in a relational database are character data, integers/real numbers, Boolean data, date/time, etc.
o Character: it is used to store text and combinations of text and numbers o Integer. It is used to store whole numbers such as 34 and 2073. o Real numbers: it is used to store numbers that have fractional part such as 23.75. o Boolean data. It is used for True or False values. Null values are not allowed. o Date and time. It is used for storing date and time.
It is an attribute (or field) that is used to identify records in a table. The purpose of key to link data together between tables without repeating all of the data in every table. The followings are the types of keys used in databases.
Primary Key: Each entity in a database must have a unique key field known as primary key identify a record. For example, Roll Number of a student can be used as primary key in a student database since it is unique key field.
Candidate or Alternate Key: A key field that can act as a primary key field in a table to unique identify each record but it is not chosen as primary key is known as candidate or alternate key For example, Roll Number of a student is chosen as primary key field in a student database N.I.C. Number of a student is unique and it can also act as primary key. Therefore, N.I.C Numb is a candidate or alternate key. Secondary Key: Sometimes a records in a table need to be searched on field other than primary key such a field is known as secondary key. For example, a student table needs to be sear by name. Then name becomes secondary key. Foreign Key: A key field used in a relationship between tables whose value matches a primary key in the other table is known as foreign key. Suppose a student database has two tables Student table that contains students’ particulars and another Result table that contains the results. Student table is the primary table in which Roll Number is primary key. To link the student table and the Result table, the field Roll Number can also be used as foreign key in the Result table.