Page 62 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 62
Unit 3: Structured Query Language
Notes
Example: CREATE TABLE Student
(Sid INT NOT NULL,
Sname CHAR(10) NUT NULL,
Project VARCHAR(15),
Class INT,
PRIMARY KEY(eid))
In this declaration, creation of student table, Sid is the primary key hence it must be unique and
it should not be NOT NULL. Project field indicates the project taken up by the student. This field
can take NULL values as it is possible that a student is not interested in taking any project/not
yet assigned a project. We restrict the insertion of NULL values in the same field by declaring it
as NOT NULL.
Lab Exercise Conceptual Design: Create 3 tables name: Books, Orders and Customers and
make ER Diagram between them.
3.12 Summary
The Structured Query Language (SQL) is a 4th Generation Language (4GL) generally used
for querying the database. Following is a consolidated list of SQL statements:
SELECT Data retrieval statement
INSERT Add rows
UPDATE Update row
DELETE Delete rows
CREATE Create new tables/views
ALTER Alter the schema or view
DROP Delete the table
RENAME Rename a table
COMMIT Buffer to disk
ROLLBACK Rollback the changes made
GRANT Assign privileges to users
REVOKE Remove the assigned privileges
The basic commands that can be used under Oracle 8i environment were discussed. For
example, @,/are some of the commands.
Oracle9i SQL *PLUS offers a rich set of data types like integer, float, number, date, etc.
The SELECT statements is used retrieve a set of rows from a specified table depending
upon the WHERE clause.
LOVELY PROFESSIONAL UNIVERSITY 55