DBMS Lab Manual PCCCS591
DBMS Lab Manual PCCCS591
DBMS Lab Manual PCCCS591
(PCCCS591)
2022-2023
5th Year
IEM Kolkata
&
What is SQL?
VARCHAR used for columns which will be used to store characters and
integers, basically a string.
CHAR used for columns which will store char values(single character).
TEXT used for columns which will store text which is generally long in
length.
Types of SQL Commands:
VARCHAR used for columns which will be used to store characters and
integers, basically a string.
CHAR: used for columns which will store char values(single character).
TEXT: used for columns which will store text which is generally long
in length. For example, if
Create Command
column_name_1 datatype_1,
column_name_2 datatype_2
…………………………………
column_name_n datatype_n
);
SQL: ALTER Command is used
To alter command is used for altering the table structure, such as,
ALTER command can also be used to modify data type of any existing
column. Following is the
syntax,
DROP command
RENAME query, it can be used to set a new name for any existing
table. Following is the syntax,
DML COMMAND
The above SQL query will only insert id and name values in the newly
inserted record.
Both the statements below will insert NULL value into age column of
the student table.
Or
Assignment 3
CUSTOMERS Table
2. COMMIT;
Thus, the delete operation would not impact the table and the SELECT
statement would produce the following result.
A SAVEPOINT is a point in a transaction when you can roll the transaction back to
a certain point without rolling back the entire transaction.
ROLLBACK TO SAVEPOINT_NAME;
Example
Savepoint created.
1 row deleted.
SAVEPOINT SP2;
Savepoint created.
1 row deleted.
SAVEPOINT SP3;
Savepoint created.
1 row deleted.
Now that the three deletions have taken place, let us assume that you have changed
your mind and decided to ROLLBACK to the SAVEPOINT that you identified as
SP2. Because SP2 was created after the first deletion, the last two deletions are undone
−
1. ROLLBACK TO SP2;
Rollback complete;
2. Find the sids of suppliers who supply some red or green part.
3. Find the sids of suppliers who supply some red part or are at 221
Packer Street.
4. Find the sids of suppliers who supply some red part and some green
part
Card (CaRd_No)
1. Retrieve details of all books in the library – id, title, name of publisher,
authors, number of copies in each branch,etc.
3. Delete a book in the BOOK table. Update the contents of other tables
to reflect this data manipulation operation.
5. Create a view of all books and its number of copies that are currently
available in the Library.
Assignment 6:
2. Find the name and numbers of all salesmen who had more than one
customer. 3. List all salesmen and indicate those who have and don’t
have customers in their cities (Use UNIONoperation.)
4. Create a view that finds the salesman who has the customer with the
highest order of a day.
Assignment 7:
2. Find the movie names where one or more actors acted in two or more
movies.
3. List all actors who acted in a movie before 2000 and also in a movie
after 2015 (use JOINoperation).
4. Find the title of movies and number of stars for each movie that has at
least one rating and find the highest number of stars that movie received.
Sort the result by movie title.
Assignment 8:
1. List all the student details studying in the fourth semester ‘C’ section.
4. Calculate the FinalIA (average of best two test marks) and update the
corresponding table for all students.
Assignment 9
DLOCATION (DNo,DLoc)
4. Retrieve the name of each employee who works on all the projects
controlled by department number
5 (use NOT EXISTS operator). For each department that has more than
five employees, retrieve the department number and the number of its
employees who are making more than Rs.6,00,000.
Assignment 10
Consider the following relations containing airline flight
information: