LAB Manual 4th Sem
LAB Manual 4th Sem
LAB Manual
Course Outcomes
COs Description
2
Design entity relation for a given scenario
1
Syllabus
2. Create a table called Employee that contain attributes EMPNO, ENAME, JOB, MGR, SAL & execute the
following.
1. Add a column commission with domain to the Employee table.
2. Insert any five records into the table.
3. Update the column details of job
4. Rename the column of Employ table using alter command.
5. Delete the employee whose Empno is 105.
1. Create Employee table containing all Records E_id, E_name, Age, Salary.
2. Count number of employee names from employeetable
3. Find the Maximum age from employee table.
4. Find the Minimum age from employeetable.
5. Find salaries of employee in Ascending Order. 6. Find grouped salaries of employees.
4. Create a row level trigger for the customers table that would fire for INSERT or UPDATE or DELETE
operations performed on the CUSTOMERS table.
This trigger will display the salary difference between the old & new Salary.
CUSTOMERS(ID,NAME,AGE,ADDRESS,SALARY)
5. Create cursor for Employee table & extract the values from the table. Declare the variables ,Open the cursor &
extrct the values from the cursor. Close the cursor. Employee(E_id, E_name, Age, Salary)
6. Write a PL/SQL block of code using parameterized Cursor, that will merge the data available in the newly
created table N_RollCall with the data available in the table O_RollCall. If the data in the first table already
exist in the second table then that data should be skipped
7. Install an Open Source NoSQL Data base MangoDB & perform basic CRUD(Create, Read, Update & Delete)
operations. Execute MangoDB basic Queries using CRUD operations.
2
Assessment Details (both CIE and SEE)
The weightage of Continuous Internal Evaluation (CIE) is 50% and for Semester End Exam (SEE) is 50%. The minimum passing
mark for the CIE is 40% of the maximum marks (20 marks out of 50) and for the SEE minimum passing mark is 35% of the
maximum marks (18 out of 50 marks). A student shall be deemed to have satisfied the academic requirements and earned the
credits allotted to each subject/ course if the student secures a minimum of 40% (40 marks out of 100) in the sum total of the CIE
(Continuous Internal Evaluation) and SEE (Semester End Examination) taken together.
CIE for the theory component of the IPCC (maximum marks 50)
● IPCC means practical portion integrated with the theory of the course.
● CIE marks for the theory component are 25 marks and that for the practical component is 25 marks.
● 25 marks for the theory component are split into 15 marks for two Internal Assessment Tests (Two Tests, each of 15 Marks with
01-hour duration, are to be conducted) and 10 marks for other assessment methods mentioned in 22OB4.2.
The first test at the end of 40-50% coverage of the syllabus and the second test after covering 85-90% of the syllabus.
● Scaled-down marks of the sum of two tests and other assessment methods will be CIE marks for the theory component of IPCC
(that is for 25 marks).
● The student has to secure 40% of 25 marks to qualify in the CIE of the theory component of IPCC.
3
Department of Artificial Intelligence and Data Science Subject Code: BCS403
Index
SL. Page
Contents
No. No.
4
BASIC CONCEPTS OF SQL
Introduction to SQL
SQL stands for “Structured Query Language” and can be pronounced as “SQL” or “sequel
– (Structured English Query Language)”. It is a query language used for accessing and modifying
information in the database. IBM first developed SQL in 1970s. Also it is an ANSI/ISO standard.
It has become a Standard Universal Language used by most of the Relational Database Management
Systems (RDBMS). Some of the RDBMS systems are: Oracle, Microsoft SQL server, Informix
etc.Most of these have provided their own implementation thus enhancing its feature and making
it a powerful tool. Few of the SQL commands used in SQL programming are SELECT
Statement,UPDATE Statement, INSERT INTO Statement, DELETE Statement, WHERE Clause,
ORDER BY Clause, GROUP BY Clause, ORDER Clause, Joins, Views,GROUP Functions,
Indexes etc.
Database Management System: It is a system software for creating & managing databases
SQL: It stands for Structured Query Launguage, which is a standard language for storing &
Managing data in Relational database management systems.
SQL Commands
SQL commands are instructions used to communicate with the database to perform specific
task that work with data. SQL commands can be used not only for searching the database but also
to perform various other functions like, for example, you can create tables, add data to tables, or
modify data, drop the table, set permissions for users.
1
CREATE TABLE Statement
The CREATE TABLE Statement is used to create tables to store data. Integrity Constraints like
primary key, unique key and foreign key can be defined for the columns while creating the table.
CREATE TABLE
table_name
(Column_name1 datatype constraint,
column_name2 datatype,
column_nameN datatype);
The Syntax for the INSERT Statement: - used to insert records in to the table.
INSERT INTO
table_name
(Column_name1, column_name2…..)
VALUES
(value1, value2,...);
The Syntax for the ALTER Statement:- used to add, delete or modify columns in a table.
Alter table table_name
UPDATE Statement: - This allows the user to update the particular column value using the where clause condition.
TRUNCATE TABLE:- Remove all records from a table, including all spaces allocated for the records are removed.
TRUNCATE TABLE
table_name;
DELETE :- This allows you to delete the particular column values using where clause condition
2
SQL Data Types:
number(size) or int
Number value with a max number of column digits specified in parenthesis.
number (size, d) or real Number value with a maximum number of digits of "size" total, with a
maximum number of "d" digits to the right of the decimal.
column_name2,..)
referenced_table_name(column_name)
4) Unique Key:
This constraint ensures that a column or a group of columns in each row have a distinct value.
A column(s) can have a null value but the values cannot be duplicated.
Syntax to define a Unique key at column level:
[CONSTRAINT constraint_name] UNIQUE
5) Check Constraint:
This constraint defines a business rule on a column. All the rows must satisfy this rule. The
constraint can be applied for a single column or a group of columns.
Syntax to define a Check constraint:
Rollback command
This command restores the database to last committed state. It is also use with savepoint command
to jump to a savepoint in a transaction.
Savepoint command
savepoint command is used to temporarily save a transaction so that you can rollback to that point
whenever necessary.
4
Program 1
COMMIT;
Disconnect;
5
2. Insert the any three records in the employee table contains attributes
EMPNO, ENAME JOB, MANAGER_NO, SAL, COMMISSION and use
rollback. Check the result.
3. Add primary key constraint and not null constraint to the employee table.
4. Insert null values to the employee table and verify the result.
INSERT INTO Employee(EMPNO, ENAME, JOB, MANAGER_NO,
SAL, COMMISSION)
VALUES (4, NULL, 'Tester', 1, NULL, NULL);
6
Program 2
Create a table called Employee that contain attributes EMPNO, ENAME, JOB, MGR,
SAL & execute the following.
1. Add a column commission with domain to the Employee table.
2. Insert any five records into the table.
3. Update the column details of job
4. Rename the column of Employ table using alter command.
5. Delete the employee whose Empno is 105.
UPDATE Employee2
SET JOB = 'Project Manager'
WHERE JOB = 'Manager';