DBMS Unit 1
DBMS Unit 1
SQL: Widely used for defining both logical and user-specific schemas.
XML: Expresses hierarchical relationships for conceptual schemas.
DDL (Data Definition Language): Defines structures and constraints for both
conceptual and internal schemas.
UML: Provides a graphical notation for conceptual schema modeling.
JSON Schema: Defines JSON document structures, suitable for external
schemas.
DDL in SQL:
SQL includes DDL statements for creating, altering, and dropping
database objects. For example:
CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Salary DECIMAL(10, 2)
);
DML in SQL:
SQL provides DML statements for querying, inserting, updating, and deleting
data. For example:
SELECT FirstName, LastName FROM Employees WHERE Salary > 50000;
DCL in SQL:
SQL includes DCL statements for managing permissions and access control.
For example:
GRANT SELECT ON Employees TO user1;
(ek DQL bhi hota hai but usme bass SELECT hota hai – nothing imp)
Super key:
• Set of attributes using which we can identify each tuple uniquely is
called Super
key.
• Let X be a set of attributes in a Relation R , if X+(Closure of X)
determines all
attributes of R then X is said to be Super key of R .
• There should be at least one Super key in every relation
Candidate key:
• Minimal set of attributes using which we can identify each tuple uniquely
is
called Candidate key. A super key is called candidate key if it’s No proper
subset
is a super key. Also called as MINIMAL SUPER KEY.
• There should be at least one candidate key.
Primary key:
• One of the candidate keys is selected by database administrator as a
Primary
means to identify tuple is called primary Key. Primary Key attribute are
not
allowed to have Null values. Exactly one Primary Key per table in RDMS.
• Candidate key which are not chosen as primary key is alternate key
Foreign Keys:
• A foreign key is a column or group of columns in a relational database
table that
refers the primary key of the same table or some other table to represent
relationship.
• The concept of referential integrity is derived from foreign key theory
Aggregation
• A concept wherein relationships are abstracted to form higher-level
entities, enabling a more organized representation of complex
relationships