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

DBMS

The document provides an overview of Database Management Systems (DBMS), highlighting their advantages over file-oriented approaches, such as improved data integrity, security, and efficiency. It covers key concepts like the relational model, normalization, functional dependencies, and SQL, as well as the roles of database administrators and the architecture of DBMS. Additionally, it discusses various types of database users and the importance of data models in structuring and managing data.

Uploaded by

bdsingh9040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

DBMS

The document provides an overview of Database Management Systems (DBMS), highlighting their advantages over file-oriented approaches, such as improved data integrity, security, and efficiency. It covers key concepts like the relational model, normalization, functional dependencies, and SQL, as well as the roles of database administrators and the architecture of DBMS. Additionally, it discusses various types of database users and the importance of data models in structuring and managing data.

Uploaded by

bdsingh9040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Section I: Overview of Database Management

1. Introduction to Database Management


A Database Management System (DBMS) is software that allows users to create, store, retrieve,
update, and manage data efficiently. Before DBMS, data was stored in separate files using a file-
oriented approach, which led to issues like redundancy and inconsistency. DBMS provides a
centralized and structured way to store and manage data, ensuring data integrity and security.
Key Features of DBMS:

✔ Data Organization: Stores data in structured formats like tables, records, and fields.
✔ Data Integrity: Ensures data accuracy and consistency using constraints.
✔ Data Security: Restricts access to authorized users.
✔ Data Independence: Changes in storage or structure do not affect applications.
✔ Concurrency Control: Multiple users can access the database simultaneously.
✔ Backup & Recovery: Ensures data safety in case of failures.

2. File-Oriented Approach vs. Database-Oriented Approach


Before the emergence of DBMS, organizations used a file-oriented system to store data. Each
application had its own set of files, and managing them was challenging. The database-oriented
approach centralized the data, ensuring better management and security.
Comparison Table: File-Oriented vs. Database-Oriented Approach

Feature File-Oriented Approach Database-Oriented Approach

Data is stored in separate files for each Data is stored centrally in a structured
Storage
application database

High (same data is repeated in multiple Low (data is shared among


Redundancy
files) applications)

Data Low (changes in one file may not reflect High (all applications access the same
Consistency in others) data)

Enforced using primary keys and


Data Integrity Difficult to enforce constraints
foreign keys

Multi-user access with security


Security Minimal access control
controls

Scalability Limited due to storage constraints Highly scalable


Example:
A university stores student records in a file-oriented system where different departments maintain
separate files. The Accounts Department has a file containing student names, fees paid, and due
amount, while the Exams Department maintains another file with student names and marks. If a
student changes their name, all files must be updated manually, leading to data inconsistency.
In a DBMS, all student information is stored in a centralized database, ensuring consistency and
eliminating redundancy.

3. Disadvantages of the File-Oriented Approach

Data Redundancy: The same data is stored multiple times, increasing storage requirements.
Data Inconsistency: If data is updated in one file but not in another, inconsistencies arise.
Security Risks: No access control mechanisms, making data vulnerable to unauthorized access.
Concurrency Issues: Multiple users cannot update the same file simultaneously.
Difficult Data Retrieval: Searching for specific data requires opening multiple files manually.
Example:
In a file-based system, an employee’s contact number is stored in multiple files (Payroll, HR,
Attendance). If the employee changes their number, it needs to be updated in all files separately,
leading to inconsistency if one file is missed.

4. Data Independence
Data Independence ensures that changes in database structure do not affect the application
programs that use the data.

Logical Data Independence: Changes in table structure do not affect user applications.
Physical Data Independence: Changes in storage format do not affect logical structure.
Example:
• If a new column "Email" is added to the Employee Table, the existing applications using the
table remain unaffected.
• If data storage changes from HDD to SSD, the logical structure of the database remains the
same.

5. Database Administrator (DBA) and Its Role


A Database Administrator (DBA) is responsible for managing, maintaining, and securing the
database.
Roles of a DBA:

✔ Database Design: Defines table structures and relationships.


✔ Security Management: Restricts access based on user roles.
✔ Performance Optimization: Enhances database speed and efficiency.
✔ Backup & Recovery: Prevents data loss due to failures.
✔ User Management: Grants or revokes database access permissions.
Example:
A DBA in a bank ensures that only tellers can access transaction details, while loan officers can
access customer loan records.

6. DBMS Architecture
A DBMS follows a three-tier architecture that separates data access from storage for better
management.
1. External Level (User View):
• Defines how different users see the data.
• Example: A student sees only their exam results, while a teacher sees all students' results.
2. Conceptual Level (Logical Structure):
• Defines the relationships between data (tables, attributes, constraints).
• Example: A database has Students, Courses, and Teachers tables.
3. Internal Level (Storage Level):
• Manages how data is stored in memory.
• Example: Data is stored in indexes and files for faster access.
Diagram: DBMS Architecture
User (External Level)

Logical Structure (Conceptual Level)

Data Storage (Internal Level)

7. Different Types of DBMS Users

End Users: People who retrieve and update data (e.g., students checking results).
Application Programmers: Developers who create applications using the database.
Database Administrators (DBAs): Manage database security and performance.
System Analysts: Design and optimize database systems.

8. Data Dictionary and Its Contents


A Data Dictionary stores metadata (data about data). It contains:
✔ Table Names (e.g., "Students")
✔ Column Names & Data Types (e.g., "Name: VARCHAR, Age: INT")
✔ Constraints (e.g., "Primary Key: Roll_No")
✔ Relationships Between Tables

9. Types of Database Languages

Data Definition Language (DDL) – Defines database structure.


CREATE TABLE Students (ID INT, Name VARCHAR(50));

Data Manipulation Language (DML) – Modifies database content.


INSERT INTO Students VALUES (101, 'John Doe');

Data Control Language (DCL) – Controls access to the database.


GRANT SELECT ON Students TO User1;

Transaction Control Language (TCL) – Manages transactions.


COMMIT;

10. Different Types of Data Models


A data model defines how data is structured and stored.

Hierarchical Model: Data is stored in a tree-like structure.


Network Model: Data is connected through multiple relationships.
Relational Model: Data is stored in tables (most widely used).
Object-Oriented Model: Data is represented as objects with attributes and behaviors.

Conclusion
In this section, we explored:
✔ The difference between file-based and database-oriented approaches.
✔ The role of a Database Administrator (DBA) in managing databases.
✔ The three-tier DBMS architecture and different types of database users.
✔ Important database languages and their functions.
Section II: Relational Model and Database Design
1. Introduction to the Relational Model
The Relational Model is the most widely used database model today. It organizes data into tables
(relations) consisting of rows (tuples) and columns (attributes). Each table represents an entity,
and relationships between tables are defined using keys.
Example of a Relational Table: Student Table

Student_ID (PK) Name Age Course

101 John Doe 20 DBMS

102 Jane Doe 21 C++

103 Alice 19 DBMS

Each row represents a unique student record, and each column represents an attribute of the
student.

2. Concept of Keys in the Relational Model


Keys are used to uniquely identify records in a table and establish relationships between tables.
Types of Keys and Their Functions

Example from "Student


Key Type Description
Table"

A set of attributes that uniquely identify a


Candidate Key (Student_ID, Name)
record.

Primary Key
The selected unique identifier for a table. Student_ID
(PK)

Foreign Key A key that refers to the Primary Key of another Student_ID in "Enrollment
(FK) table. Table"

Example of Foreign Key Relationship


Student Table

Student_ID (PK) Name Age

101 John Doe 20

102 Jane Doe 21


Course Enrollment Table

Enrollment_ID Student_ID (FK) Course

1 101 DBMS

2 102 C++

Here, Student_ID in the Course Enrollment Table is a Foreign Key that references Student_ID in
the Student Table.

3. Fundamental Integrity Rules


A DBMS enforces integrity rules to ensure data consistency and correctness.
1. Entity Integrity Rule:
o Each table must have a Primary Key, and its value cannot be NULL.

o Example: Every student must have a unique Student_ID.


2. Referential Integrity Rule:
o A Foreign Key must match an existing Primary Key in the referenced table.

o Example: A course enrollment record cannot exist for a student ID that does not
exist in the Student Table.

4. Relational Algebra
Relational Algebra is a mathematical approach to manipulate and retrieve data in relational
databases.

Operation Symbol Description Example


Selection σ Retrieves specific rows σ Age > 20 (Students) → Returns students
older than 20.
Projection π Retrieves specific π Name, Age (Students) → Returns only Name
columns & Age.
Join ⨝ Combines two tables Students ⨝ Enrollment

5. Database Design – ER Model


What is the ER Model?
The Entity-Relationship (ER) Model is a conceptual framework used for database design. It
represents entities, attributes, and relationships visually using ER Diagrams.
Basic ER Model Components:
• Entities: Objects (e.g., Students, Courses)
• Attributes: Characteristics (e.g., Name, Age)
• Relationships: Links between entities (e.g., "Enrolls in")
Example ER Diagram for a University Database
[STUDENT] ----(Enrolls In)----> [COURSE]
(ID, Name) (Code, Title)

6. Strong and Weak Entities


Strong Entity
• Can exist independently.
• Has a Primary Key.
• Example: A Student is a strong entity because it exists independently.
Weak Entity
• Cannot exist without a Strong Entity.
• Requires a Foreign Key from a Strong Entity.
• Example: A Library Card is a weak entity because it depends on a Student.

7. Functional Dependencies & Normalization


What is Functional Dependency?
• A Functional Dependency exists when one attribute uniquely determines another.
• Example: Roll_No → Name (If we know Roll_No, we can find Name).
Normalization in Relational Model
Normalization is a process to reduce redundancy and improve data integrity.

Normal Form Condition Example

1NF (First Normal


No repeating groups Each column holds atomic values
Form)

2NF (Second Normal No partial Every non-key attribute depends on the whole
Form) dependencies primary key

3NF (Third Normal No transitive Every non-key attribute depends only on the
Form) dependencies primary key
BCNF (Boyce-Codd No non-trivial functional dependencies except
Stronger form of 3NF
NF) candidate keys

8. SQL (Structured Query Language)


SQL is used to query and manipulate relational databases.
1. Basic SQL Query Structure:
SELECT column_name
FROM table_name
WHERE condition
GROUP BY column_name
HAVING condition
ORDER BY column_name;
2. Common SQL Commands:

Retrieving Data:
SELECT Name, Age FROM Students WHERE Age > 20;

Inserting Data:
INSERT INTO Students (ID, Name, Age) VALUES (101, 'John Doe', 20);

Updating Data:
UPDATE Students SET Age = 21 WHERE ID = 101;

Deleting Data:
DELETE FROM Students WHERE ID = 101;
3. Nested Queries
A Nested Query is a query inside another query.
SELECT Name FROM Students WHERE ID IN (SELECT Student_ID FROM Enrollment WHERE
Course='DBMS');
This retrieves the names of students enrolled in the DBMS course.

Conclusion
In this section, we covered:
✔ The Relational Model and its importance in databases.
✔ Key concepts like Primary Keys, Foreign Keys, Integrity Rules.
✔ Relational Algebra for querying databases.
✔ Database Design using the ER Model.
✔ The process of Normalization to remove redundancy.
✔ SQL for querying and modifying relational data.

Section III: Normalization, Functional Dependencies, and SQL


1. Introduction to Normalization in Relational Databases
Normalization is a systematic process of organizing data in a database to reduce redundancy and
improve integrity. It divides large tables into smaller ones and defines relationships to ensure
efficient storage and retrieval.
Why is Normalization Needed?
• Eliminates data redundancy (duplicate data).
• Ensures data consistency (no conflicting values).
• Improves data integrity (prevents anomalies).
• Enhances database efficiency and reduces storage space.

2. Functional Dependencies
Definition:
A functional dependency (FD) is a constraint between two sets of attributes in a relation. It states
that one attribute uniquely determines another.
Example:
In a Student Table,
Roll_No → Name, Age
• This means that for each Roll_No, we can determine the Name and Age.
Types of Functional Dependencies

Type Description Example

The dependent attribute is a subset of


Trivial FD {Roll_No, Name} → Name
the determinant.

The dependent attribute is not a


Non-Trivial FD Roll_No → Name
subset of the determinant.

Multivalued One attribute determines multiple Student →→ Course (A student can


Dependency values of another. take multiple courses)
Type Description Example

Transitive
If A → B and B → C, then A → C. Roll_No → Hostel_ID → Room_No
Dependency

3. Normal Forms in Relational Model


Normalization follows different Normal Forms (NF) to progressively improve the database
structure.
1NF (First Normal Form)
Condition: No repeating groups or arrays.
Every column should have atomic (indivisible) values.
Example (Unnormalized Table - Not in 1NF):

Student_ID Name Courses

101 John DBMS, C++

102 Alice Java, Python

Problem: Courses are stored in a single column as a list.

Convert to 1NF (Atomic Values in Separate Rows)

Student_ID Name Course

101 John DBMS

101 John C++

102 Alice Java

102 Alice Python

2NF (Second Normal Form)


Condition: 1NF + No Partial Dependencies (Every non-key attribute should depend on the whole
primary key).
Example (Table Not in 2NF):

Student_ID (PK) Course_ID (PK) Student_Name Course_Name

101 DB101 John DBMS

101 C102 John C++


Problem: Student_Name depends only on Student_ID, and Course_Name depends only on
Course_ID.

Convert to 2NF (Break into Two Tables)


Student Table:

Student_ID (PK) Student_Name

101 John

Course Table:

Course_ID (PK) Course_Name

DB101 DBMS

C102 C++

Enrollment Table (Bridging Table):

Student_ID (FK) Course_ID (FK)

101 DB101

101 C102

3NF (Third Normal Form)


Condition: 2NF + No Transitive Dependencies.

Problem (Not in 3NF):

Employee_ID (PK) Employee_Name Department_ID Department_Name

201 Alice D1 HR

202 Bob D2 IT

Here, Department_Name depends on Department_ID, which depends on Employee_ID.

Convert to 3NF (Break into Separate Tables)


Employee Table:

Employee_ID (PK) Employee_Name Department_ID (FK)

201 Alice D1

202 Bob D2
Department Table:

Department_ID (PK) Department_Name

D1 HR

D2 IT

BCNF (Boyce-Codd Normal Form)


Condition: 3NF + Every determinant must be a candidate key.
BCNF is a stricter form of 3NF and ensures better normalization.

4. Structured Query Language (SQL)


SQL is the standard language used to manage relational databases.
1. SQL Construct
The basic SQL query format is:
SELECT column_name
FROM table_name
WHERE condition
GROUP BY column_name
HAVING condition
ORDER BY column_name;
2. Important SQL Commands
Data Definition Language (DDL) – Structure Management

✔ CREATE TABLE – Creates a new table.


✔ ALTER TABLE – Modifies an existing table.
✔ DROP TABLE – Deletes a table.
CREATE TABLE Students (
Student_ID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT
);
Data Manipulation Language (DML) – Data Handling
✔ INSERT – Adds new records.
✔ UPDATE – Modifies existing records.
✔ DELETE – Removes records.
INSERT INTO Students VALUES (101, 'John Doe', 20);
UPDATE Students SET Age = 21 WHERE Student_ID = 101;
DELETE FROM Students WHERE Age < 18;
Data Control Language (DCL) – Permissions

✔ GRANT – Gives access.


✔ REVOKE – Removes access.
GRANT SELECT ON Students TO User1;
REVOKE SELECT ON Students FROM User1;

5. SQL Views
A View is a virtual table that stores query results without storing actual data.
Creating a View:
CREATE VIEW YoungStudents AS
SELECT Name, Age FROM Students WHERE Age < 21;
Using a View:
SELECT * FROM YoungStudents;
Advantages of Views:

✔ Provides security by restricting direct table access.


✔ Simplifies complex queries.
✔ Helps in data abstraction.

6. Nested Queries
A Nested Query is a query inside another query.
SELECT Name FROM Students
WHERE Student_ID IN (SELECT Student_ID FROM Enrollment WHERE Course='DBMS');
This retrieves names of students enrolled in the DBMS course.

Conclusion
In this section, we covered:
✔ Functional Dependencies and their role in databases.
✔ Normalization techniques (1NF, 2NF, 3NF, BCNF) to remove redundancy.
✔ SQL operations for creating, modifying, and querying databases.
✔ Views and Nested Queries to optimize data retrieval.

Section IV: FoxPro – A Database Management System


1. Introduction to FoxPro
FoxPro is a Relational Database Management System (RDBMS) that provides data storage,
retrieval, and management with a built-in programming environment. It was developed by Fox
Software and later acquired by Microsoft.
Key Features of FoxPro:

Supports relational database management.


Offers indexing, searching, sorting, and updating capabilities.
Includes Report Generation tools for structured outputs.
Allows Screen Designing for user-friendly data entry.
Provides programming constructs for automation.

2. Database Construction in FoxPro


To create a database in FoxPro, we need to:
1. Define a table structure.
2. Enter data into the table.
3. Perform operations like searching, sorting, indexing, and updating.
Creating a Table in FoxPro
FoxPro uses the CREATE TABLE command to define a new database table.
CREATE TABLE Students (Student_ID INT, Name CHAR(30), Age INT, Course CHAR(20))

3. Searching, Sorting, and Indexing in FoxPro


Searching Data in FoxPro
FoxPro allows searching specific records using conditions.
LIST FOR Age > 20

✔ This command displays all students older than 20 years.


Sorting Data in FoxPro
Sorting helps in arranging data in ascending or descending order.
SORT ON Name TO Sorted_Students

✔ This creates a Sorted_Students table with records sorted by Name.


Indexing in FoxPro
Indexing is used to speed up search operations.
INDEX ON Student_ID TAG StudentIndex

✔ This creates an index on Student_ID, allowing faster retrieval of student records.

4. Updating Data in FoxPro


FoxPro allows updating records in a database.
REPLACE ALL Course WITH "DBMS" FOR Student_ID = 101

✔ This updates the Course for Student_ID = 101 to DBMS.

5. Reports in FoxPro
FoxPro provides Report Generation Tools to create structured output.
Steps to Generate a Report:
1. Use the REPORT FORM command.
2. Define headers, footers, and fields to display.
3. Preview or print the report.
REPORT FORM StudentReport PREVIEW

✔ This generates a report preview of the StudentReport table.

6. Screen Designing in FoxPro


FoxPro allows designing custom user interfaces for data entry using the @...GET command.
Example of a Simple Input Screen:
@ 10,10 SAY "Enter Student Name: " GET Name
@ 12,10 SAY "Enter Age: " GET Age
READ

✔ This creates an interactive form for entering Name and Age.


7. Programming Concepts in FoxPro
FoxPro supports procedural programming using loops, conditions, and functions.
1. Conditional Statements
IF Age > 18
? "Eligible for College"
ELSE
? "Not Eligible"
ENDIF

✔ Displays eligibility based on Age.


2. Loops in FoxPro
FOR i = 1 TO 5
? "Student Number:", i
ENDFOR

✔ Prints student numbers from 1 to 5.


3. Functions in FoxPro
FoxPro provides built-in string and numeric functions.

Function Description Example

UPPER() Converts text to uppercase UPPER("foxpro") → "FOXPRO"

LOWER() Converts text to lowercase LOWER("FOXPRO") → "foxpro"

LEN() Returns string length LEN("Database") → 8

SUBSTR() Extracts substring SUBSTR("FoxPro",1,3) → "Fox"

8. Managing Numbers & Dates in FoxPro


1. Working with Numbers
FoxPro allows performing basic arithmetic operations.
STORE 10 TO a
STORE 5 TO b
? a + b && Output: 15
? a * b && Output: 50
✔ Stores values in variables and performs calculations.
2. Date Handling in FoxPro
FoxPro supports date functions to manipulate date values.
SET DATE BRITISH
STORE DATE() TO today
? today

✔ Stores the current date in today and displays it.

Function Description Example

DATE() Returns current date ? DATE() → "02/03/2025"

CTOD() Converts string to date CTOD("02/03/25")

DTOS() Converts date to string DTOS(DATE())

9. Case Studies in FoxPro


1. Inventory Control System
An inventory system manages stock, suppliers, and sales.

Product_ID Product_Name Quantity Price

101 Laptop 50 50000

102 Mouse 200 500

FoxPro Commands for Inventory Management:


UPDATE Inventory SET Quantity = Quantity - 1 WHERE Product_ID = 101

✔ Reduces stock when a product is sold.

2. Payroll Processing System


A payroll system manages employee salaries, deductions, and attendance.

Emp_ID Name Salary Tax_Deduction Net_Pay

201 Alice 50000 5000 45000

202 Bob 40000 4000 36000


FoxPro Commands for Payroll Processing:
REPLACE ALL Net_Pay WITH Salary - Tax_Deduction

✔ Calculates Net Salary after tax deduction.

Conclusion
In this section, we covered:
✔ FoxPro as an RDBMS and its database construction.
✔ Searching, Sorting, Indexing, and Updating data.
✔ Report generation and screen designing.
✔ Programming concepts (Loops, Conditions, Functions).
✔ Handling Numbers & Dates in FoxPro.
✔ Case studies on Inventory Control and Payroll Processing.

Top 30 Short Answer Questions with Answers for Exam Preparation


These questions cover Database Management, SQL, Normalization, Relational Model, and
FoxPro, ensuring you focus on highly probable exam topics.

1. What is a Database Management System (DBMS)?


Answer: A DBMS is software that allows users to create, manage, and manipulate databases
efficiently. It ensures data consistency, security, and integrity. Examples: MySQL, Oracle, SQL
Server.
2. What is Data Independence?
Answer: Data Independence refers to the ability to modify data structure without affecting the
application programs. It has two types:
• Logical Data Independence – Change schema without altering applications.
• Physical Data Independence – Change storage without affecting schema.
3. What is the difference between File-Oriented and Database-Oriented Approach?
Answer:

Aspect File-Oriented Approach Database-Oriented Approach

Data Redundancy High Low

Consistency Difficult to maintain Easy to maintain

Security Less secure More secure


Aspect File-Oriented Approach Database-Oriented Approach

Data Access Slower Faster

4. What is the role of a Database Administrator (DBA)?


Answer: A DBA is responsible for database design, security, backup, recovery, and performance
tuning.
5. What are the types of database models?
Answer:
1. Hierarchical Model – Tree structure (e.g., IBM IMS)
2. Network Model – Many-to-many relationships
3. Relational Model – Uses tables (e.g., MySQL)
4. Object-Oriented Model – Stores objects
6. Define Primary Key and Foreign Key.
Answer:
• Primary Key – Uniquely identifies each record in a table.
• Foreign Key – A field in one table that references the Primary Key of another table.
7. What is an Entity-Relationship (E-R) Diagram?
Answer: An E-R Diagram represents entities, attributes, and relationships visually to design a
database. Example: A Student table connected to a Course table.
8. What is Normalization in DBMS?
Answer: Normalization is the process of reducing data redundancy and improving integrity by
structuring the database into smaller, related tables.
9. Explain the different normal forms in DBMS.
Answer:
• 1NF (First Normal Form) – No duplicate columns.
• 2NF (Second Normal Form) – No partial dependency.
• 3NF (Third Normal Form) – No transitive dependency.
• BCNF (Boyce-Codd NF) – Stronger version of 3NF.
10. What is Relational Algebra?
Answer: Relational Algebra is a set of operations on relational databases. Common operations:
• Selection (σ) – Filters rows.
• Projection (π) – Selects columns.
• Union (∪) – Combines tables.
• Join (⨝) – Combines tables based on keys.
11. What is the difference between SQL and MySQL?
Answer:
• SQL (Structured Query Language) – A language for managing databases.
• MySQL – A database management system that uses SQL.
12. What are the types of SQL commands?
Answer:
• DDL (Data Definition Language) – CREATE, ALTER, DROP
• DML (Data Manipulation Language) – INSERT, UPDATE, DELETE
• DCL (Data Control Language) – GRANT, REVOKE
• TCL (Transaction Control Language) – COMMIT, ROLLBACK
13. What is the difference between DELETE, TRUNCATE, and DROP?
Answer:

Command Function Rollback Possible?

DELETE Removes specific rows Yes

TRUNCATE Removes all rows No

DROP Deletes table structure No

14. What is a View in SQL?


Answer: A View is a virtual table based on a SQL query. Example:
CREATE VIEW Student_View AS SELECT Name, Age FROM Students WHERE Age > 18;
15. What is a Nested Query?
Answer: A query inside another query. Example:
SELECT Name FROM Students WHERE Age = (SELECT MAX(Age) FROM Students);
16. What are Joins in SQL?
Answer: Joins combine data from multiple tables.
• INNER JOIN – Returns matching rows.
• LEFT JOIN – Returns all rows from the left table, matched rows from the right.
• RIGHT JOIN – Returns all rows from the right table, matched rows from the left.
• FULL JOIN – Returns all records from both tables.
17. What is the difference between CHAR and VARCHAR?
Answer:
• CHAR(n) – Fixed length (e.g., CHAR(10) always stores 10 characters).
• VARCHAR(n) – Variable length (e.g., VARCHAR(10) only stores actual data).
18. What is a Trigger in SQL?
Answer: A Trigger is a special procedure that executes automatically when an event (INSERT,
UPDATE, DELETE) occurs in a table.
19. What is Indexing in SQL?
Answer: Indexing speeds up search operations. Example:
CREATE INDEX StudentIndex ON Students(Name);
20. What is FoxPro?
Answer: FoxPro is a Relational Database Management System (RDBMS) used for database
creation, management, and application development.
21. What are the features of FoxPro?
Answer:
• Supports relational database management.
• Provides indexing, sorting, searching.
• Allows screen designing and report generation.
• Includes programming constructs for automation.
22. What is the command to create a database in FoxPro?
Answer:
CREATE TABLE Students (ID INT, Name CHAR(30), Age INT)
23. What is the command to list records in FoxPro?
Answer:
LIST ALL
24. How do you sort data in FoxPro?
Answer:
SORT ON Name TO Sorted_Students
25. How do you update records in FoxPro?
Answer:
REPLACE ALL Age WITH 20 WHERE Name = "John"
26. What is the command to delete records in FoxPro?
Answer:
DELETE FROM Students WHERE Age < 18
27. How do you generate a report in FoxPro?
Answer:
REPORT FORM StudentReport PREVIEW
28. What are the different data types in FoxPro?
Answer:
• Character (Char) – Stores text.
• Numeric (Num) – Stores numbers.
• Date (Date) – Stores dates.
• Logical (Bool) – Stores True/False.
29. What is the purpose of Indexing in FoxPro?
Answer: Indexing speeds up searching by creating sorted references.
30. What is the use of the READ command in FoxPro?
Answer: It pauses execution and waits for user input in screen designing.

You might also like