Database Management System
Assignment 3
Name : Muhammad Saadullah Asif
Registration No. : F23BSEEN1M01212
Professor: Sir Gulraiz Javed
Q No 1: Differences Between Primary Key and Unique Key
The Primary Key is a column or a combination of columns that uniquely identifies each record
in a table. It cannot contain NULL values and ensures that each entry is distinct. There can only
be one primary key in a table.
In contrast, a Unique Key also ensures that all values in a column are unique, but it allows for a
single NULL value. Unlike primary keys, a table can have multiple unique keys.
Key Differences:
● Null Values: Primary keys cannot have NULL values, while unique keys can have one NULL.
● Number of Keys: A table can only have one primary key but can accommodate multiple unique
keys.
● Indexing: A primary key automatically creates a clustered index, whereas a unique key creates a
non-clustered index by default.
Q No 2: Explain the concept of ACID properties in DBMS?
ACID stands for Atomicity, Consistency, Isolation, and Durability. These properties ensure
reliable processing of database transactions.
● Atomicity: Ensures that all operations within a transaction are completed successfully. If
any operation fails, the entire transaction is rolled back.
● Consistency: Guarantees that a transaction brings the database from one valid state to
another, maintaining all predefined rules (constraints).
● Isolation: Ensures that concurrent transactions do not interfere with each other. Each
transaction must be isolated from others until it is complete.
● Durability: Ensures that once a transaction is committed, it remains so, even in the event
of a system failure.
Q No 3. Use the Oracle database.
1. Show how a new user can be created (the user should be
different for every student).
2. Show how the DBA role is granted to the new user.
To create a new user and grant the DBA role in Oracle, you can use the following SQL
commands:
1. Create User:
2. Grant DBA Role:
Q No 4. If q no. 3 is done successfully, then; create a connection
between Oracle database and Oracle Developer, show complete
screenshots of the successful connection:
1. when establishing a connection.
2. After the connection is created, the connection is shown in the
left panel or not.
1. Establishing a Connection:
●
●
●
●
Open Oracle SQL Developer.
Click on the "New Connection" button.
Fill in the connection details (Username, Password, Hostname, Port, SID/Service Name).
Click "Test" to verify the connection.
2. After Connection:
● Check the left panel to see if the connection appears under "Connections".
● You should see the newly created connection listed.
Q No 5. If q no. 4 is done successfully then; show usage of create
table command in oracle developer environment and design
table/tables for your term project there should be the proper
concept of primary key, foreign key and other constraints if
necessary.
Here’s an example of creating a table with primary and foreign keys: