Page 157 - DMGT505_MANAGEMENT_INFORMATION_SYSTEM
P. 157
Management Information Systems
Notes 8.3.3 Relational Operations SQL
Structured Query Language, popularly known as SQL is the language that is used in most
relational database systems. It is called structured query language because it follows a rigorous
set of rules and procedures in answering queries. SQL is also termed as 4GL to distinguish it
from other 3GL programming languages like, PASCAL, COBOL or C.
SQL is a simple and powerful query language that is capable of answering simple to most
complex queries. Any query on a single table can be performed by using only two basic operators,
namely SELECT and PROJECT.
The select operator selects a set of records from the table, whereas PROJECT takes out selected
fields from the table. The two operators may be understood, in the user’s view, as a horizontal
cut and vertical cut, respectively of the table. Another operator JOIN is also used in SQL when
the query requires more than one table. JOIN links or combines two tables together over a
common field.
Now, we illustrate the working of RDBMS system with the help of the following examples.
The Tables are created using data definition language. Typical constructs for creating Table 8.3
and 8.4 would be as follows:
Create Table Course
CNO Char (5),
CTITLE Char (25),
CREDITS integer,
STDNO integer,
TCODE Char (3),
Create Table Teacher
TCODE Char (3),
NAME Char (20),
DEPTT Char (5),
DESIG Char (12),
PHONE Char (8),
Table 8.3: Data Table Course
CNO CTITLE CREDITS STDNO TCODE
CS101 MIS 6 25 07
CS201 SAD 4 25 15
CS304 Software 4 25 30
Engineering
CS406 Information 3 20 06
Technology
CS303 Strategic Systems 4 20 11
152 LOVELY PROFESSIONAL UNIVERSITY