Ce316p Labmanual
Ce316p Labmanual
Ce316p Labmanual
B.Tech Semester 4
Subject: Database Management System
Subject Code: CE316P
List of Experiments
Sr. Date of
No. Title submission Sign Remark
1 To study DDL-create and DML-insert commands. 22-12-24
2 Create the below given table and insert the data 29-12-24
accordingly.
To Perform various data manipulation commands, 05-05-24
3 aggregate functions and sorting concept on all
created tables
4 To study Single-row functions. 12-01-24
5 Displaying data from Multiple Tables (join). 19-01-24
TABLE : DEPOSIT
TABLE : BRANCH
TABLE : BORROW
1. Write a query to display the current date. Label the column Date.
2. For each employee, display the employee number, job, salary, and salary increased by 15% and
expressed as a whole number. Label the column New Salary
3. Modify your query no 4.(2) to add a column that subtracts the oldsalary from the new salary.
Label the column Increase.
4. Write a query that displays the employee’s names with the first letter capitalized and all other
letters lowercase, and the length of the names, for all employees whose name starts with J, A, or
M. Give each column an appropriate label. Sort the results by the employees’ last names.
5. Write a query that produces the following for each employee: earns monthly.
6. Display the hiredate of emp in a format that appears as Seventh of June 1994 12:00:00 AM.
7. Write a query to calculate the annual compensation of all employees (sal+comm.).
1. Write a query to display the last name and hire date of any employee in the same department as
SCOTT. Exclude SCOTT.
2. Give name of customers who are depositors having same branch cityof mr. sunil.
3. Give deposit details and loan details of customer in same city where pramod is living.
4. Create a query to display the employee numbers and last names of all employees who earn more
than the average salary. Sort the results in ascending order of salary.
5. Give names of depositors having same living city as mr. anil and having deposit amount greater
than 2000.
6. Display the department number, name, and job for every employee in the Accounting
department.
7. List the name of branch having highest number of depositors.
8. Give the name of cities where in which the maximum numbers of branches are located.
9. Give name of customers living in same city where maximum depositors are located.
This chapter describes Point Base security and privileges. Schemas are an integral part of security in
Point Base. When creating a Point Base user, they do not have any access privileges to schemas or other
data objects within the database. The Point Base RDBMS only permits the schema owner to grant
privileges to the schema and data objects within the schema. The schema owner can grant privileges to
the following data objects in the schema:
Tables
Columns
SQL Procedures and Functions
Table 1 describes the privileges that the schema owner can grant users for tables and columns:
Table 1 : User Privileges for Tables and Columns
DELETE Allows a user to delete rows from tables within the schema
INSERT Allows a user to insert rows of data into tables within the schema
Use the GRANT statement to grant privileges on a data object. The following describes the GRANT
statement syntax.
Privilege-list Syntax
privilege [ , privilege [ , privilege ]...] | ALL PRIVILEGES
Privilege Syntax
SELECT [ ( column-name [ , column-name ]...)]
| DELETE
| INSERT [ ( column-name [ , column-name ]...)]
| UPDATE [ ( column-name [ , column-name ]...)]
| REFERENCES [ ( column-name [ , column-name ]...)]
| TRIGGER [ ( column-name [ , column-name ]...)]
| EXECUTE
• The following statement grants the SELECT privilege on the CUSTOMER_TBL table to the
user MARKETING_MGR.
GRANT SELECT
ON customer_tbl
TO marketing_mgr;
• The following GRANT statement allows the user FINANCIAL_MGR to delete, insert and
update rows from the DISCOUNT_CODE_TBL table; it also allows this user to grant the same
privileges to others.
GRANT DELETE,INSERT,UPDATE
ON discount_code_tbl TO financial_mgr
WITH GRANT OPTION;
• The following GRANT statement allows the user HR_MGR to have ALL PRIVILEGES on the
table SALES_REP_DATA_TBL. However, the user HR_MGR will only be granted privileges
that the user granting the privileges has the right to grant. For example, if the user granting the
privileges does not have the right to grant DELETE privileges, the HR_MGR will not have the
delete privilege.
GRANT ALL PRIVILEGES
ON sales_rep_data_tbl TO hr_mgr
REVOKE Statement Syntax
REVOKE [ GRANT OPTION FOR ] privilege_list
ON object
FROM user_name [ RESTRICT | CASCADE ]
The REVOKE statement takes privileges away from users. The arguments are similar to the GRANT
statement. The major difference is the additional RESTRICT or CASCADE keyword and the GRANT
OPTION FOR clause. The following describes the optional clauses GRANT OPTION FOR and
RESTRICT or CASCADE.
NOTE: If none of the privileges that you are trying to revoke actually exist, an error is raised.
Database Management System CE316P
RESTRICT | CASCADE
If you use RESTRICT keyword, the privilege will be revoked only from the specified user. If the
specified user granted had the WITH GRANT OPTION and granted the same privilege to other users,
they will retain the privilege.
If you use CASCADE, it will revoke the privilege and any dependent privileges as a result of your
grant. A dependent privilege is one that could exist, if you granted the privilege that you're trying to
revoke, which is what you are trying to achieve as a result of your REVOKE statement.
If the optional RESTRICT or CASCADE keywords are not used, PointBase uses RESTRICT by
default.
GRANT OPTION FOR
If he optional GRANT OPTION FOR clause is used, the WITH GRANT OPTION right is revoked. The
actual privilege itself is not revoked. the GRANT OPTION is revoked. CASCADE and RESTRICT
may be used in the same way as a normal REVOKE statement.
TCL Commands in SQL- Transaction Control Language Examples: Transaction Control Language can
be defined as the portion of a database language used for maintaining consistency of the database and
managing transactions in database. A set of SQL statements that are co-related logically and executed
on the data stored in the table is known as transaction. In this tutorial, you will learn different TCL
Commands in SQL with examples and differences between them.
1. Commit Command
2. Rollback Command
3. Savepoint Command
TCL Commands in SQL- Transaction Control Language Examples
The modifications made by the DML commands are managed by using TCL commands. Additionally, it
makes the statements to grouped together into logical transactions.
TCL Commands
There are three commands that come under the TCL:
1. Commit
The main use of Commit command is to make the transaction permanent. If there is a need for any
transaction to be done in the database that transaction permanent through commit command. Here is the
general syntax for the Commit command:
COMMIT;
For Example
UPDATE STUDENT SET STUDENT_NAME = ‘Maria’ WHERE STUDENT_NAME =
‘Meena’; COMMIT;
By using the above set of instructions, you can update the wrong student name by the correct one and
save it permanently in the database. The update transaction gets completed when commit is used. If
commit is not used, then there will be lock on ‘Meena’ record till the rollback or commit is issued.
2. Rollback
Using this command, the database can be restored to the last committed state. Additionally, it is also
used with savepoint command for jumping to a savepoint in a transaction.
The general syntax for the Rollback command is mentioned below: Rollback to savepoint-name;
For example
3. Savepoint
The main use of the Savepoint command is to save a transaction temporarily. This way users can
rollback to the point whenever it is needed.
The general syntax for the savepoint command is mentioned below: savepoint savepoint-name;
For Example