0% found this document useful (0 votes)
3 views

SQL Ct Question

The document explains the concepts of specialization and generalization in ER diagrams, where generalization combines lower-level entities into a higher-level entity, while specialization breaks down a higher-level entity into lower-level entities. It also describes the structure of ER diagrams for library and college management systems, outlines the three-level architecture of DBMS, and details the ACID properties of transaction systems. Additionally, it covers the roles of a Database Administrator, the distinction between DDL and DML commands, and provides SQL query examples for various data retrieval tasks.

Uploaded by

Sourav Smanta
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL Ct Question

The document explains the concepts of specialization and generalization in ER diagrams, where generalization combines lower-level entities into a higher-level entity, while specialization breaks down a higher-level entity into lower-level entities. It also describes the structure of ER diagrams for library and college management systems, outlines the three-level architecture of DBMS, and details the ACID properties of transaction systems. Additionally, it covers the roles of a Database Administrator, the distinction between DDL and DML commands, and provides SQL query examples for various data retrieval tasks.

Uploaded by

Sourav Smanta
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Q. Explain specialization and generalization.

Concept in ER diagram and statement.

Generalization is a bottom-up approach in which two lower level entities combine to form
a higher level entity. In generalization, the higher level entity can also combine with other
lower level entities to make further higher level entity. It's more like Superclass and
Subclass system, but the only difference is the approach, which is bottom-up. Hence,
entities are combined to form a more generalised entity, in other words, sub-classes are
combined to form a super-class.
generalization in ER model

For example, Saving and Current account types entities can be generalised and an entity
with name Account can be created, which covers both.
Specialization
Specialization is opposite to Generalization. It is a top-down approach in which one higher
level entity can be broken down into two lower level entity. In specialization, a higher
level entity may not have any lower-level entity sets, it's possible.
Specialization in ER Model

Q. Define ER diagram and library management & college management diagram.


ER Diagram Example for Library Management Systems
To get a better overview of how exactly a library management system works, let us
explore an example.
ER diagram of a Library Management System contains various entities and their attributes,
which explains the overall structure and functioning of a library and ultimately helps in
designing its database. A Library Management System database keeps track of the
following considerations –
• Both the Admin and users can log in to access the permitted functionalities in a
Library database.
• The Admin maintains the book record by updating the availability status of books
and can add or delete book records.
• Every Book has its own Barcode No, title, Price, availability status, author, and other
details.
• Every user is registered with their library_id, name (first name, last name), Mobile
No, email, address, and the number of books issued. The Admin keeps track of all
the users.
• Every Admin is registered with their admin_id, name (first name, last name), Mobile
No, email, and address.
• Users can issue and return books corresponding to which, they will have an issue
date and return date respectively. A user can get the books issued from the Admin
after successful login.
This ER diagram illustrates a College Management System involving Students, Courses,
Professors, and Departments. Students are enrolled in courses, with each student linked
to a department. Courses are taught by professors, with each course associated with a
department. Professors work in departments, and departments have heads overseeing
them.
Q. Explain 3 label architecture of data base management system.
The three-level architecture of a DBMS includes:
• External Level: This is the user view, where users interact with the database.
• Conceptual Level: This is the community view, which describes what data is stored
in the database and the relationships among those data.
• Internal Level: This is the physical view, which describes how the data is stored in
the database.

Q. What is transaction system. Explain ACID property.


A transaction system ensures that database transactions are processed reliably. The ACID
properties are:
• Atomicity: Ensures that all operations within a transaction are completed;
otherwise, the transaction is aborted.
• Consistency: Ensures that the database remains in a consistent state before and
after the transaction.
• Isolation: Ensures that transactions are executed in isolation from one another.
• Durability: Ensures that the results of a transaction are permanently stored in the
database.
Q. Who is data base administrator & it's function.
A Database Administrator (DBA) is responsible for managing and maintaining the
database system. Functions include:
• Installing and configuring the database.
• Ensuring data integrity and security.
• Performing backups and recovery.
• Monitoring database performance.
• Managing user access and permissions.

Q. DDL command & DML command.


Data Definition Language (DDL)
DDL commands are used to define and manage the structure of database objects such as
tables, indexes, and schemas. These commands deal with the schema and structure of the
database.
Examples include CREATE, ALTER, DROP.
Data Manipulation Language (DML)
DML commands are used to manipulate the data stored in the database. These commands
deal with the data itself.
Examples include SELECT, INSERT, UPDATE, DELETE.

Q. Explain Keys.
Keys are attributes or sets of attributes that help in uniquely identifying a record in a
table. Types of keys include:
• Primary Key: Uniquely identifies each record in a table.
• Foreign Key: A field in one table that uniquely identifies a row of another table.
• Candidate Key: A set of attributes that uniquely identify a record.
• Composite Key: A key that consists of two or more attributes.
SQL query
Q. Write a SQL query to fetch employee I'd, full name, of all employees working under the
manager I'd 986.
SELECT EmployeeID, FullName
FROM EmployeeDetails
WHERE ManagerID = 986;

Q. To fetch the different projects available from the employee salary table.
SELECT DISTINCT ProjectName
FROM EmployeeSalary;

Q. To fetch the count of employees working in the project P1.


SELECT COUNT(*)
FROM EmployeeProjects
WHERE ProjectName = 'P1';

Q. To find the maximum minimum and average salary of the employee.


SELECT
MAX(Salary) AS MaxSalary,
MIN(Salary) AS MinSalary,
AVG(Salary) AS AvgSalary
FROM EmployeeSalary;

Q. To find the employee I'd whose salary lies in the range of 9k and 15k.
SELECT EmployeeID
FROM EmployeeSalary
WHERE Salary BETWEEN 9000 AND 15000;
Q. To fetch those employees who live in toranto and work under the manager and manager
I'd 321.
SELECT EmployeeID, FullName
FROM EmployeeDetails
WHERE City = 'Toronto' AND ManagerID = 321;

Q. To fetch all the employee who either live in California and who work under the work and
work manager 321.
SELECT EmployeeID, FullName
FROM EmployeeDetails
WHERE City = 'California' OR ManagerID = 321;

You might also like