Rdbms 10 Marks
Rdbms 10 Marks
Components of DBMS:
Diagram:
+--------------------+
| User |
+--------------------+
|
v
+--------------------+
| Application Program |
+--------------------+
|
v
+--------------------+
| Query Processor |
| (Parses & validates queries) |
+--------------------+
|
v
+--------------------+
| Storage Manager |
| (Handles data I/O) |
+--------------------+
|
v
+--------------------+
| Disk Storage |
| (Data Files, |
| Data Dictionary, |
| Indices) |
+--------------------+
1. Unary Operators:
2. Multiplicative Operators:
`*`, `/`
3. Additive Operators:
`+`, `-`
4. Comparison Operators:
7. AND
8. OR
```sql
SELECT *
FROM employees
WHERE salary > 50000 OR (salary > 30000 AND
department = 'HR');
```
In this expression:
- The condition inside the parentheses `salary > 30000
AND department = 'HR'` is evaluated first.
```sql
CREATE TABLE Students (
StudentID int,
Name varchar(255),
Age int
);
```
2. ALTER: Modifies an existing database object, such as a
table.
```sql
ALTER TABLE Students ADD COLUMN Grade
varchar(2);
```
3. DROP: Deletes an existing database object.
```sql
DROP TABLE Students;
```
4. TRUNCATE: Removes all records from a table, but the
table structure remains.
```sql
TRUNCATE TABLE Students;
```
```sql
INSERT INTO Students (StudentID, Name, Age)
VALUES (1, 'John Doe', 20);
```
2. UPDATE: Modifies existing records in a table.
```sql
UPDATE Students SET Age = 21 WHERE StudentID =
1;
```
3. DELETE: Removes existing records from a table.
```sql
DELETE FROM Students WHERE StudentID = 1;
```
4. SELECT: Retrieves data from a table.
```sql
SELECT * FROM Students;
```
6. Views in DBMS
7. Database Triggers
Example:
Example: `INT`.
1. Client:
2. Server:
Types of Servers
Communication Protocols
```
DECLARE
num NUMBER;
factorial NUMBER := 1;
BEGIN
num := &input_num; -- Accept input from the user
```sql
CREATE TABLE Customer (
Cno INT,
Cname VARCHAR(50),
Ccity VARCHAR(50)
);
Union Query
The `UNION` operation combines the result sets of two or
more `SELECT` queries:
```sql
SELECT Ccity FROM Customer
UNION
SELECT CCity FROM Account;
```
Intersection Query
```sql
SELECT Ccity FROM Customer
INTERSECT
SELECT CCity FROM Account;
```
16.Explain about the operators in SQL.
Nested Queries:
Complex Queries: