Professional Documents
Culture Documents
Asd Lab Manual - Lab1
Asd Lab Manual - Lab1
CS333
APPLICATION SOFTWARE DEVELOPMENT LAB
LAB MANUAL
Expected Outcome
The students will be able to
i. Design and implement a database for a given problem using database design
principles.
ii. Apply stored programming concepts (PL-SQL) using Cursors and Triggers.
iii. Use graphical user interface, Event Handling and Database connectivity to develop
and deploy applications and applets.
iv. Develop medium-sized project in a team.
No Name of Experiment
1 Creation of a database and tables using DDL commands.
2 DML queries to retrieve information from the database.
3 Insertion, Deletion, Modifying, Altering, and Updating records.
4 Creating a database to set various constraints.
5 Creating relationship between the databases.
6 Implementation of built in functions in RDBMS.
7 Implementation of aggregate functions in SQL.
8 Implementation of Order By, Group By& Having clause.
9 Implementation of set operators, nested queries and Join queries.
10 Implementation of various control structures using PL/SQL.
11 Creation of Procedures and Functions.
12 Creation of database Triggers and Cursors.
13 Creation of Views and Assertions.
14 Mini project
1. Creation of a Database using DDL Commands
A database is a collection of related data. Data is the known facts that can be
recorded and that have implicit meaning. A database is a logically coherent collection of
data with some inherent meaning. A random assortment of data cannot correctly be referred
to as a database.
Defining a database involves specifying the data types, structures, and constraints of the data
to be stored in the database. The database definition or descriptive information is also stored
by the DBMS in the form of a database catalog or dictionary; it is called meta-data.
Constructing the database is the process of storing the data on some storage medium that is
controlled by the DBMS.
Manipulating a database includes functions such as querying the database to retrieve specific
data, updating the database to reflect changes in the mini world, and generating reports from
the data.
Sharing a database allows multiple users and programs to access the database
simultaneously.
An application program accesses the database by sending queries or requests for data to the
DBMS.
A transaction may cause some data to be read and some data to be written into the database.
A data definition language (DDL) is used to define the database conceptual schema.
The relational model represents the database as a collection of relations. Informally, each
relation resembles a table of values or, to some extent, a flat file of records. When a relation
is thought of as a table of values, each row in the table represents a collection of related data
values. A row represents a fact that typically corresponds to a real-world entity or
relationship. The table name and column names are used to help to interpret the meaning of
the values in each row.
a) Create Database
1. SHOW DATABASES;
Example:-
CREATE TABLE IF NOT EXISTS Members(membership_number INT
AUTOINCREMENT,full_names VARCHAR(150) NOT NULL ,gender VARCHAR(6),
date_of_birth DATE ,physical_address VARCHAR(255) ,postal_address
VARCHAR(255) ,contact_number VARCHAR(75) ,email VARCHAR(255) , PRIMARY KEY
(`membership_number`) );
DESC Table_Name;
Problem:
Create a DATABASE named as “UNIVERSITY” with the following TABLES.
1. STUDENT(Name, Student_Number, Semester, Branch)
2. COURSE(Name,Course_Number, Department, Credit)
3. SECTION(Section_Id,Course_Number,Semester,Year,Instructor)
4. GRADE_REPORT(Student_Number, Section_Id,Grade)
5. PREREQUISITE(Course_Number,Prerquisite_number)
Lab 1:
Once the database schemas are compiled and the database is populated with data, users must
have some means to manipulate the database. Typical manipulations include retrieval,
insertion, deletion, and modification of the data. The DBMS provides a set of operations or a
language called the data manipulation language (DML) for these purposes.
Example
Example
Domain constraints can be violated if an attribute value is given that does not appear in the
corresponding domain or is not of the appropriate data type.
Key constraints can be violated if a key value in the new tuple t already exists in another
tuple in the relation r(R).
Entity integrity can be violated if any part of the primary key of the new tuple t is NULL.
Referential integrity can be violated if the value of any foreign key in t refers to a tuple that
does not exist in the referenced relation.
INSERT INTO <table name> VALUES (<value 1>, ... <value n>);
Example
The Delete operation can violate only referential integrity. This occurs if the tuple being
deleted is referenced by foreign keys from other tuples in the database. To specify deletion, a
condition on the attributes of the relation selects the tuple (or tuples) to be deleted.
If the WHERE clause is omitted, then every row of the table is deleted.
The Update (or Modify) operation is used to change the values of one or more attributes in a
tuple (or tuples) of some relation R. It is necessary to specify a condition on the attributes of
the relation to select the tuple (or tuples) to be modified.SET clause in the UPDATE command
specifies the attributes to be modified and their new values.
Example:
Fig 2.1
Lab2: