Revised Flashcards

(88 cards)

1
Q

What is DBMS?

A

DBMS (Database Management System) is software used to create, store, manage, and manipulate data efficiently.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the main function of DBMS?

A

It acts as an interface between the user and the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Give examples of DBMS software.

A

MySQL, Oracle, PostgreSQL, MS Access, MongoDB.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

List components of DBMS.

A

Hardware, Software, Data, Users, Procedures.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the hardware component of DBMS?

A

Devices used for storage and data access.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the software component of DBMS?

A

The DBMS program that manages the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Who are the users of DBMS?

A

DBA, Designer, End-user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are procedures in DBMS?

A

Rules and instructions on how to use and manage the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

List advantages of DBMS.

A

Reduces redundancy, ensures data integrity, provides security, supports backup and recovery, allows concurrent access, and enables data sharing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does DBMS ensure data integrity?

A

By enforcing constraints and validation rules on data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the types of DBMS?

A

Hierarchical, Network, Relational, Object-Oriented.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Describe Hierarchical DBMS.

A

Organizes data in a tree-like structure (e.g., IBM IMS).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Describe Network DBMS.

A

Uses many-to-many relationships (e.g., IDMS).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Describe Relational DBMS.

A

Stores data in tables of rows and columns (e.g., MySQL, Oracle).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Describe Object-Oriented DBMS.

A

Stores data as objects (e.g., db4o).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a primary key?

A

A field that uniquely identifies a record in a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a foreign key?

A

A field that refers to the primary key in another table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a candidate key?

A

All possible attributes that can uniquely identify a record.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is an alternate key?

A

A candidate key not chosen as the primary key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is a composite key?

A

A combination of multiple attributes used to uniquely identify a record.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is a super key?

A

Any set of attributes that can uniquely identify a record.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is normalization?

A

The process of organizing data to reduce redundancy and improve integrity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Explain 1NF.

A

Ensures atomic values; removes repeating groups.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Explain 2NF.

A

Removes partial dependency; ensures each non-key attribute depends on the whole key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Explain 3NF.
Removes transitive dependency; non-key attributes depend only on primary key.
26
Explain BCNF.
Every determinant must be a candidate key; stronger than 3NF.
27
What are the types of SQL commands?
DDL, DML, DQL, DCL, TCL.
28
What are DDL commands?
CREATE, ALTER, DROP, TRUNCATE – define database structure.
29
What are DML commands?
INSERT, UPDATE, DELETE – manipulate data.
30
What are DQL commands?
SELECT – used to query data.
31
What are DCL commands?
GRANT, REVOKE – manage access control.
32
What are TCL commands?
COMMIT, ROLLBACK, SAVEPOINT – manage transactions.
33
What is an INNER JOIN?
Returns matching rows from both tables.
34
What is a LEFT JOIN?
Returns all rows from left table and matched rows from right table.
35
What is a RIGHT JOIN?
Returns all rows from right table and matched rows from left table.
36
What is a FULL JOIN?
Returns all rows from both tables; unmatched rows have NULLs.
37
What are constraints in DBMS?
Rules applied to columns to ensure data accuracy and integrity.
38
List common constraints.
NOT NULL, UNIQUE, CHECK, DEFAULT, PRIMARY KEY, FOREIGN KEY.
39
Explain 1-Tier Architecture.
Database and application are on the same system.
40
Explain 2-Tier Architecture.
Client communicates directly with database server.
41
Explain 3-Tier Architecture.
Client interacts with an application server, which connects to the database server.
42
Explain 3-level architecture of DBMS.
Internal (physical), Conceptual (logical), and External (user view) levels.
43
What is a transaction?
A single logical unit of work like money transfer.
44
What are ACID properties?
Atomicity, Consistency, Isolation, Durability.
45
Define Atomicity.
Transaction is all or nothing.
46
Define Consistency.
Database remains in a valid state before and after transaction.
47
Define Isolation.
Transactions execute independently.
48
Define Durability.
Once committed, changes are permanent.
49
What is PL/SQL?
An Oracle extension of SQL that supports variables, loops, and exception handling.
50
What is a trigger?
A stored procedure that executes automatically when an event occurs (e.g., INSERT, UPDATE).
51
What is a cursor?
A database object used to retrieve and process data row by row.
52
What is a view?
A virtual table created from query results.
53
What is an ER model?
Represents data using entities, attributes, and relationships.
54
List types of relationships in ER Model.
One-to-One, One-to-Many, Many-to-Many.
55
What is functional dependency?
If attribute Y depends on X, written as X → Y.
56
What is indexing in DBMS?
Technique to improve search/query performance.
57
What is backup and recovery?
Process to restore data after a failure or loss.
58
Difference between DBMS and File System?
DBMS reduces redundancy and provides security, while file system lacks these features.
59
What are database anomalies?
Problems in database design like insertion, deletion, and update anomalies.
60
Give an example of DBMS application.
School DB with tables: Students, Teachers, Courses linked via keys.
61
What is data abstraction?
Hiding complexity of database details from users.
62
What is data independence?
Ability to change schema at one level without affecting higher levels.
63
What is data dictionary?
A repository containing metadata about database objects.
64
What is a schema?
Logical design or structure of the database.
65
What is a subquery?
A query nested inside another SQL query.
66
What is a stored procedure?
Precompiled SQL statements stored in the database.
67
What is concurrency control?
Technique to manage simultaneous data access by multiple users.
68
What is deadlock?
A situation where two or more transactions wait for each other indefinitely.
69
70
Front
Back
71
PL/SQL
Oracle's procedural extension to SQL allowing variables, loops, and exception handling.
72
PL/SQL Example
DECLARE v_name VARCHAR2(20); BEGIN SELECT name INTO v_name FROM Students WHERE ID = 1; DBMS_OUTPUT.PUT_LINE(v_name); END;
73
Control Structure
Used to control program flow in PL/SQL like IF, LOOP, FOR, CASE.
74
IF Example
IF marks >= 40 THEN DBMS_OUTPUT.PUT_LINE('Pass'); ELSE DBMS_OUTPUT.PUT_LINE('Fail'); END IF;
75
Loop Example
FOR i IN 1..5 LOOP DBMS_OUTPUT.PUT_LINE('Count: ' || i); END LOOP;
76
Exception Handling
Handles runtime errors gracefully using EXCEPTION block.
77
Exception Example
BEGIN SELECT name INTO v_name FROM Students WHERE ID = 100; EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE('Record not found'); END;
78
Cursor
Used to process query results row-by-row.
79
Cursor Example
DECLARE CURSOR student_cur IS SELECT name FROM Students; OPEN student_cur; FETCH...; CLOSE student_cur;
80
Procedure
A reusable PL/SQL block that performs a specific task.
81
Procedure Example
CREATE OR REPLACE PROCEDURE add_student(p_id INT, p_name VARCHAR2) AS BEGIN INSERT INTO Students(ID, Name) VALUES(p_id, p_name); END;
82
Clauses
WHERE, GROUP BY, ORDER BY, HAVING, DISTINCT, LIKE control how data is filtered, grouped, and sorted.
83
WHERE Clause Example
SELECT * FROM Students WHERE Age > 18;
84
GROUP BY Clause Example
SELECT Class, COUNT(*) FROM Students GROUP BY Class;
85
ORDER BY Clause Example
SELECT * FROM Students ORDER BY Name ASC;
86
HAVING Clause Example
SELECT Class, COUNT(*) FROM Students GROUP BY Class HAVING COUNT(*) > 10;
87
DISTINCT Clause Example
SELECT DISTINCT Class FROM Students;
88
LIKE Clause Example
SELECT * FROM Students WHERE Name LIKE 'A%';