Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

A Micro Project on

Designing a Relational Database for University Register’s


Office
Submitted to the requirement for the award of the Laboratory of

Database Management Systems


Of
II B.Tech I Semester
In
Electronics and Communications Engineering
Submitted by
C. LAKSHMI SREE 22R01A0411
C. SRIKANTH 22R01A0412
CH. AKASH 22R01A0413

Under the guidance of


Mrs.B.Annapurna
(Assistant Professor)

CMR INSTITUTE OF TECHNOLOGY


(UGC AUTONOMOUS)
(Approved by AICTE, Affiliated to JNTU, Kukatpally, Hyderabad)
Kandlakoya, Medchal Road, Hyderabad

2023-2024

1
CMR Institute of Technology
(UGC AUTONOMOUS)
(Approved by AICTE, Affiliated to JNTU, Kukatpally, Hyderabad) Kandlakoya,
Medchal Road, Hyderabad.

CERTIFICATE
This is to certify that a Micro Project entitled with: “DESIGNING A RELATIONAL
DATABASE FOR UNIVERSITY REGISTER’S OFFICE” is being

Submitted by
C. LAKSHMI SREE 22R01A0411
C. SRIKANTH 22R01A0412
CH. AKASH 22R01A0413

In partial fulfillment of the requirement for award of the Database Management


Systems Laboratory of II B. Tech II Semester in ECE to the CMRIT, Hyderabad is a
record of a bonafide work carried out under our guidance and supervision.

Signature of Faculty Signature of HOD


Mrs.B. Annapurna Dr. K. Niranjan Reddy
(Assistant Professor) (Head of Departmentt)
(ECE) (ECE)

2
ACKNOWLEDGEMENT
We are extremely grateful to Dr. M. Janga Reddy, Director,
Dr. B. Satyanarayana, Principal and Mr. A. Prakash, Head of Department, Dept of
Computer Science and Engineering, CMR Institute of Technology for their inspiration
and valuable guidance during entire duration.

We are extremely thankful to our Database Management Systems Lab faculty


in-charge, Mrs. B.Annapurna (Associate Professor), Dept of Electronics and
communication Engineering, CMR Institute of Technology for her constant guidance,
encouragement and moral support throughout the project.

We express our thanks to all staff members and friends for all the help and
coordination extended in bringing out this Project successfully in time.

Finally, we are very much thankful to our parents and relatives who guided
directly or indirectly for successful completion of the project.

C. LAKSHMI SREE 22R01A0411


C. SRIKANTH 22R01A0412
CH. AKASH 22R01A0413

3
CONTENTS

Particulars Page No.

1. Introduction 5

2. Advantages of RDBMS 9

3. SQL Query 10

4. Conclusion 13

5. References 13

4
INTRODUCTION:

Database Management Systems:


● A database management system (or DBMS) is essentially nothing more
than a computerized data-keeping system.
● Users of the system are given facilities to perform several kinds of operations
on such a system for either manipulation of the data in the database or the
management of the database structure itself.
● There are several types of databases that can be used on a mainframe to
exploit z/OS®: inverted list, hierarchic, network, or relational.

Relational Database Management Systems (RDBMS):

● All modern database management systems like SQL, MS SQL Server, IBM
DB2, ORACLE, My-SQL and Microsoft Access are based on RDBMS.
● It is called Relational Data Base Management System (RDBMS) because it is
based on relational model introduced by E.F. Codd.
● Relational database is most commonly used database. It contains number of
tables and each table has its own primary key.

SQL:

● SQL stands for Structured Query Language. It is used for storing and managing
data in relational database management system (RDBMS).
● It is a standard language for Relational Database System. It enables a user to
create, read, update and delete relational databases and tables.
● All the RDBMS like MySQL, Informix, Oracle, MS Access and SQL Server
use SQL as their standard database language.
● SQL allows users to query the database in a number of ways, using English-like
statements.

SQL follows the following rules:


● Structure query language is not case sensitive. Generally, keywords of
SQL are written in uppercase.
● Statements of SQL are dependent on text lines. We can use a single SQL
statement on one or multiple text line.
● Using the SQL statements, you can perform most of the actions in a database.
● SQL depends on tuple relational calculus and relational algebra.

5
SQL Commands:
● SQL commands are instructions. It is used to communicate with the database.
It is also used to perform specific tasks, functions, and queries of data.
● SQL can perform various tasks like create a table, add data to tables, drop
the table, modify the table, set permission for users.

Types of SQL Commands:

There are five types of SQL commands: DDL, DML, DCL, TCL, and DQL.

Data Definition Language (DDL):


● DDL changes the structure of the table like creating a table, deleting a table,
altering a table, etc.
● All the command of DDL is auto-committed that means it permanently saves all
the changes in the database.
Here are some commands that come under DDL:
● CREATE
● ALTER
● DROP
● TRUNCATE

6
a. DROP: It is used to delete both the structure and record stored in the table.
Syntax: DROP TABLE table_name;

b. ALTER: It is used to alter the structure of the database. This change could be either
to modify the characteristics of an existing attribute or probably to add a new
attribute.
Syntax: ALTER TABLE table_name ADD column_name COLUMN-definition;

c. TRUNCATE: It is used to delete all the rows from the table and free the space
containing the table.
Syntax: TRUNCATE TABLE table_name;

Data Manipulation Language:


● DML commands are used to modify the database. It is responsible for all form
of changes in the database.
● The command of DML is not auto-committed that means it can't permanently
save all the changes in the database. They can be rollback.
● INSERT
● UPDATE
● DELETE
a. INSERT: The INSERT statement is a SQL query. It is used to insert data into the row
of a table.
Syntax: INSERT INTO TABLE_NAME (col1, col2, col3. col N) VALUES
(value1, value2, value3, valueN);

b. UPDATE: This command is used to update or modify the value of a column in the
table. Syntax: UPDATE table_name SET [column_name1= value1,...column_nameN
= valueN] [WHERE CONDITION]

c. DELETE: It is used to remove one or more row from a table.


Syntax: DELETE FROM table_name [WHERE condition];

Data Control Language:


DCL commands are used to grant and take back authority from any database user. Here
are some commands that come under DCL:
● Grant
● Revoke

a. Grant: It is used to give user access privileges to a database.


Syntax: GRANT SELECT, UPDATE ON MY_TABLE TO SOME_USER,
ANOTHER_USER;

7
b. Revoke: It is used to take back permissions from the user.
Syntax: REVOKE SELECT, UPDATE ON MY_TABLE FROM USER1, USER2;

Transaction Control Language:


TCL commands can only use with DML commands like INSERT, DELETE and
UPDATE only.
These operations are automatically committed in the database that's why they cannot be
used while creating tables or dropping them.
Here are some commands that come under TCL:
• COMMIT
• ROLLBACK
• SAVEPOINT
a. Commit: Commit command is used to save all the transactions to the database.
Syntax: COMMIT;

b. Rollback: Rollback command is used to undo transactions that have not already been
saved to the database.
Syntax: ROLLBACK;

c. SAVEPOINT: It is used to roll the transaction back to a certain point without rolling
back the entire transaction.
Syntax: SAVEPOINT SAVEPOINT_NAME;

Data Query Language:


DQL is used to fetch the data from the database. It uses only one command:
•SELECT
a. SELECT: This is the same as the projection operation of relational algebra. It is used
to select the attribute based on the condition described by WHERE clause.
Syntax: SELECT expressions FROM TABLES WHERE conditions;

Relational Algebra
Relational algebra is a procedural query language, which takes instances of relations as
input and yields instances of relations as output. It uses operators to perform queries. An
operator can be either unary or binary. They accept relations as their input and yield
relations as their output. Relational algebra is performed recursively on a relation and
intermediate results are also considered relations.

REQUIREMENTS:
Hardware Requirements:

• Intel(R) Core (TM) i7-1005G1 CPU @ 1.20GHz 1.19 GHz


• 4 GB OF RAM

Software Requirements:

• Windows 11 Home Single Language


• Oracle Database 11g Express Edition
8
ADVANTAGES OF RDBMS
The pros of a relational database management system offer a methodical view of data,
which helps businesses improve their decision-making processes by enhancing different
areas.

Various other advantages of a relational database model:

● Enhanced Data Security

● Retain Data Consistency

● Better Flexibility and Scalability

● Easy Maintenance

● Reduced Risk of Errors

The tables can be connected in different ways, such as:

● A record in one table could be related to another record in a different table (1:1
relationship)
● A record in one table may be related to several records in other tables (1:M
relationship)
● Several table records could be linked to multiple records in a different table (M: N
relationship)

However, before tables are created, a relational database management system must ensure
that:

● Each table has a unique primary key, which has no null values.
● The foreign key, which is used to relate to 2 tables, is preserved in one table and
refers to the primary key of another table.
● No column has a null value (empty cell).

9
SQL Query

1. Student (student-id, name, program)

SQL> Create table Student (student_id number (10) primary key, name char
(20), program varchar2(10));

OUTPUT:
Student_id name program

2. Course (courseno, title, syllabus, credits)

SQL> Create table Course (courseno varchar2 (10) primary key, title char
(10), syllabus char(10), credits number(10));

OUTPUT:
courseno title syllabus credits

3. Course-offering (courseno, secno, year, semester, time, room)

SQL> Create table Course-offering (courseno varchar2 (10), secno char


(10), year number(10), semester varchar2(10), time date, room number(10),
foreign key (courseno) references course(courseno));

OUTPUT:

courseno secno year semester time room

10
4. Instructor (instructor-id, name, dept, title)

SQL> Create table Instructor (instructor_id number (7) primary key, name
char (10), dept char (7), title char (10));

OUTPUT:

Instructor_id name dept title

5. Enrols (student-id, courseno, secno, semester, year, grade)

SQL> Create table Enrols (student_id number (10), courseno varchar2 (10),
secno char (10), semester varchar2(10), year number (5), grade varchar2(5),
foreign key(courseno) references Course(courseno), foreign key(student_id)
references student(student_id), foreign key (secno) references
Course-offering(secno), foreign key(semester) references
Course-offering(semester));

OUTPUT:
student_id courseno secno semester year grade

6. Teaches (courseno, secno, semester, year, instructor-id)

SQL> Create table Teaches (courseno varchar2(10), secno char (10),


semester varchar2(10),year number(5), instructor_id number(7),foreign
key(courseno) references Course(courseno),foreign key(secno) references
Course-offering(secno),foreign key(semester) references Course-
offering(semester), foreign key(instructor_id) references
Instructor(instructor_id));

11
OUTPUT:

Instructor_id name dept title

7. Requires (maincourse, prerequisite)

SQL> Create table Requires (maincourse char (10), prerequisite


varchar2(10));

OUTPUT:

maincourse prerequisite

12
CONCLUSION

Relational databases store data in tables. Tables can grow large and have a multitude of
columns and records. Relational database management systems (RDBMSs) use SQL (and
variants of SQL) to manage the data in these large tables. The RDBMS you use is your
choice and depends on the complexity of your application.

You learned that the structure of a relational database is based on the relational model.
You also learned that the largest structure in a relational database is a table, which
contains fields, records, and a primary key. You discovered that using the primary-key
field to link tables allows data to be accessed in a relational database.

Finally, you learned that Structured Query Language (SQL) is the programming language
used to create relational databases, and that a relational database management system
(RDBMS) is a software package used to manage relational databases.

REFERENCES

● https://www.oracle.com/in/database/what-is-a-relation
al-database/
● https://www.ionos.com/digitalguide/hosting/technical-
matters/relational-databases/

13

You might also like