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

V.S.

International College
Tribhuvan University
Minbhawan,Kathmandu,Nepal

Lab Report of Database Administration(CACS405)


Faculty of Humanities and Social Science
Tribhuvan University
Kritipur,Nepal

Submitted By
Name: Rabina Ghimire
Submitted To
V.S. International College
Department of Bachelor in Computer Applications
Minbhawan,Kathmandu,Nepal

Signature:- --------------------- -----------------------


Internal Examiner External Examiner
ACKNOWLEDGEMENT

First and foremost, I would like to express my heartfelt gratitude to my esteemed


lecturer Mr. Prawin Ayadi for granting me the golden opportunity to undertake the
remarkable project related to oracle database and for their unwavering guidance
throughout this endeavor. Their invaluable advice, motivation, and support were
instrumental in the successful completion of the project.

Additionally, I extend my thanks to all the lecturers who provided me with essential
advice and knowledge, which proved vital in the development of the project.

I would like to acknowledge VS International College for their continuous


guidance, supervision, and provision of necessary information, as well as for their
unwavering support throughout the project's development.

Furthermore, I extend my appreciation to my friends whose unwavering support


has been a constant source of encouragement throughout this project. Without their
support, I could not have achieved the successful completion of this endeavor.

Lastly, I express my gratitude to Tribhuvan University for providing me with this


opportunity through the course of Computer Application, which has not only
helped me understand project ethics but also allowed me to evaluate my
knowledge and expand it further.

Your Sincerely ,

Rabina Ghimire
Table Of Contents
Introduction to Oracle___________________________________________________________4
Architecture of Oracle Database___________________________________________________4
Installation of Oracle Database 19c________________________________________________6
Managing Users, Roles and Privileges_____________________________________________11
Introduction to Oracle
Oracle Corporation is a multinational computer technology corporation that specializes in developing and
selling database software and technology, cloud-engineered systems, and enterprise software products.
One of its flagship products is the Oracle Database, a relational database management system (RDBMS).
This is a high-level overview, and Oracle Database architecture can be quite complex, with many
additional features and components depending on the version and edition of the Oracle Database being
used..

Architecture of Oracle Database


Here is a brief overview of Oracle Database architecture:
Instance: An instance is the combination of memory structures and background processes that manage
the Oracle database. Memory structures include the System Global Area (SGA), which consists of
components like the shared pool, buffer cache, and redo log buffer.
Database: The database is a set of physical files on disk that store data. These files include data files,
control files, and redo log files. Data files store the actual data, control files manage the database, and
redo log files store changes made to the database.
Background Processes: Oracle Database relies on several background processes to perform various tasks
such as managing memory, monitoring user sessions, and performing I/O operations. Examples include
the PMON (Process Monitor) and SMON (System Monitor).
SQL Processing: When a user issues a SQL query, it undergoes several stages of processing. The Oracle
database parses the query, generates an execution plan, and then executes the plan to retrieve or modify
data.
Redo Log: The redo log is crucial for maintaining data integrity and recovery. It records changes made to
the database so that in the event of a failure, transactions can be recovered to a consistent state.
Data Dictionary: Oracle maintains a data dictionary, which is a set of tables and views containing
metadata about the database. It stores information about tables, indexes, users, privileges, and other
database objects.
Tablespaces and Data Files: The data in an Oracle database is logically organized into tablespaces,
which consist of one or more data files. Tablespaces are used to manage the storage and retrieval of data
efficiently.
Oracle Net Services: Oracle Net Services enable communication between clients and the Oracle
database. It handles tasks such as connecting to the database, establishing sessions, and transmitting SQL
statements.
Installation of Oracle Database 19c
Step 1: Download Oracle Database 19c software for windows
The first step is to head over to the official Oracle download page. You'll find a bunch of different
packages there. For this guide, we'll be focusing on the Oracle Database 19c (19.3) for Microsoft
Windows x64 (64-bit) package. If you're planning to access your Oracle database remotely in the future,
you can also grab the Oracle Database 19c Client (19.3) for Microsoft Windows x64 (64-bit) or Oracle
Database 19c Client (19.3) for Microsoft Windows (32-bit) based on your client computer's architecture.
This way, you'll be all set to install and manage your Oracle database smoothly.
Step 2: Launch the setup wizard
Once the download is complete

 unzip the package then copy it to the root of your disk;


 rename the folder, choose a shorter name (eg. db_home);
 then launch the setup.

Figure 1 Lauch the setup wizard

Step 3: Choose database installation options


This step is super important because it gives you the freedom to choose the installation options for Oracle.
You have a couple of choices here. One option is to install the Oracle software and create a database at
the same time, known as "Create and configure a single instance database." However, since you only
want to install the Oracle 19c software and its components, you can go for the "Create and configure a
single instance database" option. This option installs the necessary components for creating and managing
a database. It's also handy if you want to upgrade from an older version like 12c or 18c, or even install
RAC. By selecting this option, you'll be able to proceed with the installation smoothly.
Figure 2 Choose database installation options

Step 4: Select system class, and then click next.


Here we are choosing desktop class as this option includes a starter database and allows minimal
configuration.

Figure 3 Select system class, and then click next.


Step 5: Specify Oracle Home User
Select Create New Windows User and then click Next. *(Optional) - You can specify an existing (or use
virtual Account) Microsoft Windows user account.

Figure 4 Specify Oracle Home User

Step 6: Typical Install Configuration


From the Oracle base field, enter or browse to select the database installation location, and then click
Next. This is where the path is identified to store the Oracle Database software and configuration files.
The installer performs several installation prerequisite checks and shows a progress bar until the checks
are completed.
Figure 5 Typical Install Configuration

Step 7: Summary
The Summary window shows your previous selections. Once reviewed, select Install to proceed.

Figure 6 Summary
Step 9: Finish
The Finish window shows your Oracle Database registration was successful. Click Close.

Figure 7 Finish
Managing Users, Roles and Privileges
1. Assigning Quotas to Users
 Quotas in Oracle Database refer to the amount of space allocated to a user for storing
objects in a specific tablespace.
 To assign quotas to users, you can use the ALTER USER statement with the QUOTA
clause, specifying the tablespace and the amount of space. It's a way to manage and
control storage in the database.
Example:
a) Connect to the Database:
Use a SQL*Plus session or another SQL client to connect to your Oracle database using a
privileged account (e.g., SYS or SYSTEM).

CONNECT sys/password AS SYSDBA;

b) Check Existing Tablespaces:


You can check the existing tablespaces in the database using the following query:

SELECT tablespace_name FROM dba_tablespaces;

c) Create a Tablespace (if needed):


If you don't have a specific tablespace for the user, you may need to create one. Replace
your_tablespace and your_datafile with appropriate values:

CREATE TABLESPACE your_tablespace


DATAFILE 'your_datafile.dbf'
SIZE 100M
AUTOEXTEND ON;

d) Grant Quota to User:


Grant the necessary quota to a user on a specific tablespace. Replace your_user, your_tablespace,
and your_quota with appropriate values:
ALTER USER your_user QUOTA your_quota ON your_tablespace;

Example
ALTER USER john_doe QUOTA 50M ON users_tablespace;
This command allows the user "john_doe" to use up to 50 megabytes of space in the
"users_tablespace."

e) Verify Quota Assignment:


Verify that the quota has been assigned correctly.
SELECT tablespace_name, username, bytes, max_bytes FROM dba_ts_quotas ;
SELECT tablespace_name, username, bytes, max_bytes FROM dba_ts_quotas WHERE
username = 'EXAMPLE_USER';

This will display information about tablespace quotas assigned to users.


2. Applying the Principle of Least Privilege(PoLP)
The Principle of Least Privilege (POLP) is a security concept that suggests providing individuals
or systems with only the minimum levels of access or permissions they need to perform their
tasks. In the context of Oracle databases, implementing the Principle of Least Privilege helps
minimize the potential damage caused by accidental or intentional misuse of privileges.

● Create Users
Let's say you have two users, user_employee and user_manager.
-- Create Employee User
CREATE USER user_employee IDENTIFIED BY password_employee;
-- Create Manager User
CREATE USER user_manager IDENTIFIED BY password_manager;

● Create Roles
Create roles to group related privileges. In this example, we create role_employee for
employee-related privileges and role_manager for manager-related privileges.
-- Create Employee Role
CREATE ROLE role_employee;
-- Create Manager Role
CREATE ROLE role_manager;

● Grant Minimum Privileges to Roles


Assign only the necessary privileges to each role.
-- Grant Employee Privileges
GRANT SELECT, INSERT, UPDATE ON employee_table TO role_employee;
-- Grant Manager Privileges
GRANT SELECT, INSERT, UPDATE, DELETE ON employee_table TO role_manager;

● Assign Roles to Users


Assign roles to the respective users.
-- Assign Employee Role to Employee User
GRANT role_employee TO user_employee;
-- Assign Manager Role to Manager User
GRANT role_manager TO user_manager;

● Test the Setup


Now, the user_employee has only the privileges necessary for employees, and the user_manager
has only the privileges necessary for managers. This adheres to the Principle of Least Privilege.
-- Test Employee User
CONNECT user_employee/password_employee;
SELECT * FROM employee_table;
-- Test Manager User
CONNECT user_manager/password_manager;
SELECT * FROM employee_table;

● ADMIN_USER:
Tasks: Perform maintenance tasks, create tables, and manage user accounts. Privileges:
DBA role for administrative tasks.
CREATE TABLE for creating tables.
CREATE USER for managing user accounts.
-- Granting privileges to ADMIN_USER
GRANT DBA TO ADMIN_USER;
GRANT CREATE TABLE TO ADMIN_USER;
GRANT CREATE USER TO ADMIN_USER;
Benefits of Applying POLP in Oracle:
Minimizes Security Risks: Users have the minimum privileges required to perform their tasks,
reducing the risk of unauthorized access or data breaches.
Easier Auditing and Monitoring: With fewer privileges, it's easier to monitor and audit user
activities. Suspicious or unauthorized actions can be identified more quickly.
Improved System Stability: Users are less likely to unintentionally interfere with other parts of
the
system since they only have access to the specific resources they need.
3. Creating and Assigning Profiles
In Oracle Database, user accounts are created and managed through profiles. A profile is a set of
resource limits and password policies that can be assigned to users. Profiles help in controlling
and managing the resources that a user can consume and enforce security policies.
Here's an example of creating and assigning profiles in Oracle:
● Creating a Profile:
-- Creating a profile named "custom_profile"
CREATE PROFILE custom_profile
LIMIT
SESSIONS_PER_USER UNLIMITED
CPU_PER_SESSION UNLIMITED
CPU_PER_CALL UNLIMITED
CONNECT_TIME 360
IDLE_TIME 60
LOGICAL_READS_PER_SESSION DEFAULT
LOGICAL_READS_PER_CALL UNLIMITED
COMPOSITE_LIMIT UNLIMITED
PRIVATE_SGA UNLIMITED
FAILED_LOGIN_ATTEMPTS 3
PASSWORD_LIFE_TIME 90
PASSWORD_REUSE_TIME UNLIMITED
PASSWORD_REUSE_MAX UNLIMITED
PASSWORD_LOCK_TIME 1
PASSWORD_GRACE_TIME 7;
This example creates a profile named "custom_profile" with various resource limits and password
policies.

● Assigning a Profile to a User:


-- Assigning the "custom_profile" to a user named "example_user"
ALTER USER example_user PROFILE custom_profile;
This statement associates the user "example_user" with the "custom_profile" profile.
● Verifying the Profile Assignment:
-- Query to verify the profile assignment for a user
SELECT profile FROM dba_users WHERE username = 'example_user';
This query confirms that the user "example_user" is associated with the "custom_profile" profile.
4.Managing Oracle Database Users, Privileges, and Roles
Managing Oracle Database users, privileges, and roles is a crucial aspect of database
administration. This involves creating, modifying, and deleting users, granting and revoking
privileges, and assigning users to roles for better access control. Here's a guide on how to perform
these tasks using SQL commands in Oracle Database:
i. Creating Users:
To create a new user, you can use the CREATE USER statement.
CREATE USER username IDENTIFIED BY password;
ii. Granting Privileges:
After creating a user, you may want to grant specific privileges to that user. Common privileges
include SELECT, INSERT, UPDATE, and DELETE. For example:
GRANT SELECT, INSERT, UPDATE, DELETE ON table_name TO username;
iii. Granting System Privileges:
System privileges control the ability to perform specific database operations. To grant system
privileges:
GRANT privilege_name TO username;
iv. Granting Roles:
Roles are a convenient way to group multiple privileges together. You can grant a role to a user
using the GRANT statement:
GRANT role_name TO username;
v. Creating Roles:
To create a new role, use the CREATE ROLE statement:
CREATE ROLE role_name;
vi. Assigning Privileges to Roles:
Grant the necessary privileges to a role:
GRANT privilege_name TO role_name;
vii. Revoking Privileges:
To revoke privileges, use the REVOKE statement:
REVOKE privilege_name FROM username;
viii. Revoking Roles:
To revoke a role from a user:
REVOKE role_name FROM username;
ix. Viewing User Privileges:
To view the privileges assigned to a user, you can query the DBA_TAB_PRIVS view:
SELECT * FROM DBA_TAB_PRIVS WHERE GRANTEE = 'username';
x. Viewing Role Privileges:
To view the privileges associated with a role:
SELECT * FROM DBA_ROLE_PRIVS WHERE GRANTEE = 'role_name';
xi. Dropping Users:
To delete a user:
DROP USER username;
xii. Dropping Roles:
To delete a role:
DROP ROLE role_name;
Remember to replace username, password, table_name, privilege_name, and role_name with your
actual values. Additionally, ensure you have the necessary administrative privileges (DBA or
SYSDBA) to perform these tasks.
5. Administering User Authentication Methods in Oracle
In Oracle Database, user authentication is a critical aspect of security. Oracle supports various
authentication methods to ensure that only authorized users can access the database. Here are
some common authentication methods in Oracle:
Database Native Authentication:
Oracle Database can use its internal user repository for authentication. Users and their passwords
are stored in the database. You can create users using the CREATE USER statement and set their
passwords using the IDENTIFIED BY clause. Example:
CREATE USER username IDENTIFIED BY password;

Enterprise User Security (EUS):


EUS integrates Oracle Database with enterprise authentication services like Microsoft Active
Directory or Oracle Internet Directory. Users are authenticated against the external directory. This
method is useful for organizations with centralized user management.

External Authentication:
External authentication allows Oracle to rely on an external service, such as the operating system
or a third-party authentication service. Users are authenticated using credentials provided by the
external service.
Example (Operating System Authentication):
CREATE USER username
IDENTIFIED EXTERNALLY;
LDAP Authentication: Oracle supports Lightweight Directory Access Protocol (LDAP) for
authentication. Users are authenticated against an LDAP directory.
Example:
CREATE USER username IDENTIFIED GLOBALLY AS
'cn=username,dc=example,dc=com';

Password File Authentication:


Oracle Database can use a password file for authentication. Passwords are stored in a password
file, and users are granted specific privileges to access the database.
Example (Creating Password File):orapwd file=orapwSID password=password
entries=10 Example (Granting Privileges): GRANT CONNECT, RESOURCE TO
username;

Network Authentication: Oracle supports secure network protocols such as Secure Sockets
Layer (SSL) and Transport Layer Security (TLS) for secure communication between the client
and
the database. This enhances the security of authentication and data transmission.
Example (Configuring SSL/TLS): ALTER SYSTEM SET
SECURE_SOCKET_LAYER=TRUE;

Lab 2:
Create database examdb and prepare a following table.

create table employee(


emp_ id int not null, emp_ name varchar(15), Department varchar(20),
DOB date, Marital_ status char(1), Job title varchar(15),
Hiredate date, salary float);

1.a. WAQ to add primary key with constraint in a field called emp_id ;
1.b. WAQ to modify the length of a field emp_name varchar(25);
1.c. WAQ to rename the name of the column department to department_name
1.d WAQ to insert the following records in a table.

•(2,'Narayan KShrestha','Politics','10/15/1965','N','Politician','10/25/1999',500000),
•(3,'Sonu Nigam','Music','10/15/1969','N','Singer','10/25/1985',5000000),
•(4,'Dr. Upendra Devkota','Health','10/15/1955','Y','Doctor','10/25/1977',500000),
•(5,'Dr. A. Kalam ','Science','10/15/1945','N','Scientist','10/25/1969',50000000),
•(6,'Dr. Bhola Rijal','Health','10/15/1960','N','Doctor','10/25/1989',400000),
•(7,'Mahabir Pun','Science','10/15/1965','Y','Scientist','10/25/2009',500000);

1.e. WAQ to display all records from employee;


1.f. WAQ to add the new column called gender varchar(10);

2.WAQ to show the employee name, and their job title.


3.WAQ to show the smallest salary of them.
4.Find the annual salary of the employees and show with their names and id.
5.Show the average salary of the employees.
6.Show the total salary paid.
7.Count the total number of employees.

Solution:
1. create table employee (emp_ id int not null, emp_ name varchar(15), Department varchar(20),
DOB date, Marital_ status char(1), Job title varchar(15), Hiredate date, salary float);
soln
CREATE TABLE employee (
emp_id INT NOT NULL,
emp_name varchar(20),
Department VARCHAR2(20),
Dob DATE,
Marital_status CHAR(1),
Job_title VARCHAR2(15),
Hiredate DATE,
salary FLOAT
);
Output:

1.a. WAQ to add primary key with constraint in a field called emp_ id .

ALTER TABLE employee


ADD CONSTRAINT pk_ emp_ id PRIMARY KEY(emp_ id);

Output:

1.b. WAQ to modify the length of a field emp_ name varchar(25).


ALTER TABLE employee
MODIFY emp_ name VARCHAR2(25);

Output:

1.c. WAQ to rename the name of the column department to department_name.


ALTER TABLE employee
rename COLUMN Department To department_name;
Output:
1.d WAQ to insert the following records in a table.
INSERT INTO employee VALUES (2, 'Narayan KShrestha', 'Politics', TO_DATE('10/15/1965',
'MM/DD/YYYY'), 'N', 'Politician', TO_DATE('10/25/1999', 'MM/DD/YYYY'), 500000);
INSERT INTO employee VALUES (3, 'Sonu Nigam', 'Music', TO_DATE('10/15/1969',
'MM/DD/YYYY'), 'N', 'Singer', TO_DATE('10/25/1985', 'MM/DD/YYYY'), 5000000);
INSERT INTO employee VALUES (4, 'Dr. Upendra Devkota', 'Health', TO_DATE('10/15/1955',
'MM/DD/YYYY'), 'Y', 'Doctor', TO_DATE('10/25/1977', 'MM/DD/YYYY'), 500000);
INSERT INTO employee VALUES (5, 'Dr. A. Kalam', 'Science', TO_DATE('10/15/1945',
'MM/DD/YYYY'), 'N', 'Scientist', TO_DATE('10/25/1969', 'MM/DD/YYYY'), 50000000);
INSERT INTO employee VALUES (6, 'Dr. Bhola Rijal', 'Health', TO_DATE('10/15/1960',
'MM/DD/YYYY'), 'N', 'Doctor', TO_DATE('10/25/1989', 'MM/DD/YYYY'), 400000);
INSERT INTO employee VALUES (7, 'Mahabir Pun', 'Science', TO_DATE('10/15/1965',
'MM/DD/YYYY'), 'Y', 'Scientist', TO_DATE('10/25/2009', 'MM/DD/YYYY'), 500000);
Output:

1.f. WAQ to add the new column called gender varchar(10);


ALTER TABLE employee
ADD gender VARCHAR(10);
UPDATE EMPLOYEE
SET gender = 'Male'
WHERE emp_id in (3,4,5,6);

UPDATE EMPLOYEE
SET gender = 'female'
WHERE emp_id in (2,7);
Output:

2.WAQ to show the employee name, and their job title.


select emp_name,Job_title from employee;

Output:

WAQ to show the smallest salary of them.


select min(salary) as minimum_salary from employee
Output:

SELECT emp_id, emp_name, salary


FROM employee
WHERE salary = (SELECT MIN(salary)FROM employee);
Output:

4.Find the annual salary of the employees and show with their names and id.

SELECT emp_id,emp_name,salary * 12 AS Annual_salary from employee;

Output:

5.Show the average salary of the employees.


SELECT avg(salary) AS AVG_salary FROM employee
Output:

6.Show the total salary paid.


SELECT SUM(salary) FROM employee
Output

7.Count the total number of employees.


SELECT COUNT (emp_id) AS total_employee FROM employee
Output;

Lab 3:
Create a database called exam_dbase and prepare the following table and insert the following
records;

create table tbl_employee( emp_id int not null, emp_name varchar(25),


emp_address varchar(25), emp_salary float, department varchar(25),
constraint pk_empId primary key(emp_id));

1.a. Insert the following data/records in a table.


•(1,'Mayank','ktm',5000,'engineering');
•(2,'Mansara','bkt',6500,'hr');
•(3,'mukesh','ktm',5500,'engineering');
•(4,'munal','bkt',6000,'hr');
•(5,'shiva','pkr',7000,'quality control');
•(6,'hari','pkr',7500,'account');
•(7,'gopal','ktm',8000,'hr');
•(8,'harish','pkr',9000,'account');

2.WAQ to show the name and salary who is getting max salary.
3.WAQ to count the number of employees who is getting salary less than avg.
4.WAQ to show the list of the employee's salary in reverse(descending)order
5.WAQ to show the maximum salary.
6.WAQ to show the name and address of the employee who is getting minimum salary.
7.WAQ to show the Total salary.
8.WAQ to show the name and salary of the employee who is getting maximum salary.
9.WAQ to display the total number of employee.

1. create table tbl_employee( emp_id int not null, emp_name varchar(25),


emp_address varchar(25), emp_salary float, department varchar(25),
constraint pk_empId primary key(emp_id));.

CREATE TABLE employedpeople(


emp_id INT NOT NULL,
emp_names VARCHAR(25),
emp_address VARCHAR(25),
emp_department VARCHAR(25),
emp_salary FLOAT
);
Output:

1.a. Insert the following data/records in a table.


•(1,'Mayank','ktm',5000,'engineering');
•(2,'Mansara','bkt',6500,'hr');
•(3,'mukesh','ktm',5500,'engineering');
•(4,'munal','bkt',6000,'hr');
•(5,'shiva','pkr',7000,'quality control');
•(6,'hari','pkr',7500,'account');
•(7,'gopal','ktm',8000,'hr');
•(8,'harish','pkr',9000,'account').
INSERT INTO employedpeople VALUES (1, 'Mayank', 'ktm', 'Engineering', 5000);
INSERT INTO employedpeople VALUES (2, 'Mansara', 'bkt', 'HR', 6500);
INSERT INTO employedpeople VALUES (3, 'Mukesh', 'ktm', 'Engineering', 5500);
INSERT INTO employedpeople VALUES (4, 'Munal', 'bkt ', 'HR', 6000);
INSERT INTO employedpeople VALUES (5, 'Shiva', 'pkr', 'Quality Control', 7000);
INSERT INTO employedpeople VALUES (6, 'Hari', 'pkr', 'Account', 7500);
INSERT INTO employedpeople VALUES (7, 'Gopal', 'ktm', 'HR', 8000);
INSERT INTO employedpeople VALUES (1, 'Harish', 'pkr', 'Account', 9000);
Output:

2.WAQ to show the name and salary who is getting max salary.
SELECT emp_names, emp_salary
FROM employedpeople
WHERE emp_salary = (SELECT MAX(emp_salary) FROM employedpeople);

Output:

3.WAQ to count the number of employees who is getting salary less than avg.
SELECT COUNT (*)
FROM employedpeople WHERE emp_salary < (SELECT AVG(emp_salary)
FROM employedpeople);

Output

4.WAQ to show the list of the employee's salary in reverse(descending)order


SELECT emp_names, emp_salary
FROM employedpeople
ORDER BY emp_salary DESC;

Output:

5.WAQ to show the maximum salary.


SELECT MAX (emp_salary)
FROM employedpeople;

Output:

6.WAQ to show the name and address of the employee who is getting minimum salary.

SELECT emp_names, emp_address From employedpeople


WHERE emp_salary = (SELECT MIN(emp_salary)FROM employedpeople);

Output:

7.WAQ to show the Total salary.

SELECT SUM(emp_salary)
FROM employedpeople

Output:

8.WAQ to show the name and salary of the employee who is getting maximum salary.

SELECT emp_names, emp_salary FROM employedpeople


WHERE emp_salary = (SELECT MAX(emp_salary)FROM employedpeople);
Output:
9.WAQ to display the total number of employee.

SELECT COUNT(*)
FROM employedpeople;
Output:

Lab 3:
Write DDL commands for following:
a. Create the table named emp having fields (emp_id, name, address DOB, salary)
b. Add primary key and check constraints in the salary fields, value of salary >10000
c. Rename the table emp to employee
d. Insert some rows and delete one of the record from the table employee
e. Create the logical backup of above table using expdp utility
f. Give select,update privilege to another user RAM.
g. Add department_id field as foreign key referencing the table department.
h. Modify the name field to increase the character length and rename the field to ename.
a. Create the table named emp having fields (emp_id, name, address DOB, salary)
CREATE TABLE tbl_employees(
emp_id INT PRIMARY KEY,
emp_name VARCHAR(50),
address VARCHAR(100),
DOB DATE,
salary DECIMAL(10,2)
);
Output:

You might also like