Chapter-1

1.What is data?

Data refers to raw, unprocessed facts and figures without context. It can be numbers, text, or other types of values that are not yet organized or interpreted for meaningful use.

2.What is information?

Information is processed, organized, or structured data that is meaningful and useful. It provides context and relevance to data, making it valuable for decision-making or analysis.

3.What is database?

A database is an organized collection of data stored and accessed electronically. It is structured to support efficient retrieval, insertion, updating, and management of data.

4.What is relational database?

A relational database is a type of database that stores data in tables with rows and columns, where relationships between the data are established using foreign keys and primary keys.

5.What is DBMS?

A DBMS (Database Management System) is software that facilitates the creation, management, and manipulation of databases. It provides tools for defining, querying, updating, and administering data.

6.What are the types of DBMS?

The main types of DBMS are hierarchical, network, relational, and object-oriented. Relational DBMS (RDBMS) is the most widely used type, employing tables to store data and relationships.

7.What is table/relation?

A table, or relation, is a collection of data organized into rows and columns. Each table represents a specific entity, and columns store attributes, while rows store individual records.

8.What is row/record/tuples in database?

A row, record, or tuple represents a single, complete set of data in a table. It contains values for each attribute (column) of a specific entity or object.

9.What is column/attribute/field in database?

A column, attribute, or field is a vertical section of a table that represents a specific data type or characteristic. Each column stores a single type of data across all rows.

10.What is primary key?

A primary key is a unique identifier for each record in a table. It ensures that each record is distinguishable and prevents duplicate entries in the table.

11.What is foreign key?

A foreign key is a column or group of columns in one table that uniquely identifies a row of another table. It establishes a relationship between two tables by linking the primary key of one table to the foreign key in another.

12.What is datatype in DBMS?

A datatype in DBMS defines the type of data that can be stored in a column. Common datatypes include integers, strings, dates, and floating-point numbers, ensuring data consistency and integrity.

13.What is the difference between CHAR and VARCHAR?

CHAR is a fixed-length data type that stores strings with a predefined length, padding with spaces if necessary. VARCHAR is a variable-length data type that stores strings, using only the necessary amount of space.

14.What is an INT datatype?

The INT datatype is used to store integer values (whole numbers) in a database. It is commonly used for fields such as age, quantity, or any value that does not require decimals.

15.What is FLOAT datatype?

The FLOAT datatype stores decimal numbers (floating-point numbers) with variable precision. It is used for values requiring fractional parts, such as measurements or financial calculations.

16.What is a query in database?

A query is a request for data or information from a database. It is typically written in SQL and allows users to retrieve, insert, update, or delete data based on specific conditions.

17.What is a VIEW in database?

A VIEW is a virtual table in a database, representing the result of a query. It does not store data itself but provides a way to present data from one or more tables in a specific format.

18.What is a SCHEMA in database?

A schema is the structural definition of a database, including tables, views, indexes, and relationships. It outlines how data is organized and how various database elements relate to one another.

19.What is database administrator (DBA)?

A DBA is a professional responsible for the management, maintenance, and security of a database. They oversee tasks such as data backup, user access control, and database optimization.

20.What is relational model?

The relational model is a database model that uses tables (relations) to represent data. It defines relationships between data using keys (primary and foreign) and enforces data integrity through normalization rules.

Chapter-2

1.What is SQL?

SQL (Structured Query Language) is a standard programming language used to manage and manipulate relational databases. It allows users to query, insert, update, delete, and manage data in a database, as well as define and control database structures and permissions.

2.What are the types of SQL commands?

SQL commands are classified into five types:
• DDL (Data Definition Language): Defines the structure of the database (e.g., CREATE, ALTER, DROP).
• DML (Data Manipulation Language): Deals with data manipulation (e.g., SELECT, INSERT, UPDATE, DELETE).
• DCL (Data Control Language): Manages permissions (e.g., GRANT, REVOKE).
• TCL (Transaction Control Language): Manages transaction operations (e.g., COMMIT, ROLLBACK).
• DQL (Data Query Language): Used for querying data (e.g., SELECT).

3.What is a DDL command?

DDL (Data Definition Language) commands are used to define and manage database structures. They include commands such as CREATE, ALTER, and DROP, which allow the creation, modification, and deletion of database objects like tables, views, and schemas.

4.What is a DML command?

DML (Data Manipulation Language) commands are used to manage data within database tables. These include commands like INSERT, UPDATE, DELETE, and SELECT, which allow for inserting, updating, deleting, and retrieving data from tables.

5.What is a DCL command?

DCL (Data Control Language) commands control access to data in a database. The main commands are GRANT (to give permissions) and REVOKE (to remove permissions). DCL helps manage user rights and security in the database system.

6.What is a TCL command?

TCL (Transaction Control Language) commands manage the changes made by DML commands. They ensure that transactions are processed reliably. Important TCL commands include COMMIT (to save changes), ROLLBACK (to undo changes), and SAVEPOINT (to mark a point for rollback).

7.What is a DQL command?

DQL (Data Query Language) is used to query data from a database. The primary command in DQL is SELECT, which retrieves data from one or more tables based on specified criteria and conditions. It is used to extract information from the database.

8.What is the difference between DML and DDL command?

DML (Data Manipulation Language) deals with manipulating data in the database (e.g., INSERT, SELECT, UPDATE, DELETE), whereas DDL (Data Definition Language) deals with defining and modifying database structure (e.g., CREATE, ALTER, DROP). DML affects data, while DDL affects database schema.

9.What is select statement?

The SELECT statement is used to query and retrieve data from one or more tables in a database. It allows users to specify columns, tables, and conditions to filter and organize the data returned, making it the most commonly used SQL command for data retrieval.

10.What is insert statement?

The INSERT statement is used to add new records (rows) into a table in a database. It specifies the table and the values to be inserted into the corresponding columns, enabling users to insert single or multiple rows of data at once.

11.What is update statement?

The UPDATE statement is used to modify existing records in a table. It allows users to change the values of one or more columns based on a condition specified by the WHERE clause, enabling selective updates of rows in a table.

12.What is delete statement?

The DELETE statement is used to remove records from a table based on a given condition. The WHERE clause specifies which rows to delete, and if no condition is provided, it deletes all records in the table, making it a destructive operation.

13.What is ALTER TABLE statement?

The ALTER TABLE statement is used to modify the structure of an existing table. It allows users to add, modify, or delete columns, change column data types, and add constraints such as primary keys or foreign keys to the table.

14.What is where clause in in SQl?

The WHERE clause in SQL is used to filter records based on specified conditions. It is typically used in SELECT, UPDATE, DELETE, and other SQL commands to restrict the rows affected or returned by the query according to specific criteria.

15.What is the LIKE operator in SQL?

The LIKE operator is used in SQL to search for a specified pattern in a column. It is commonly used with the WHERE clause to filter results based on patterns, such as using % for any sequence of characters or _ for a single character.

16.What is the AND operator in SQL?

The AND operator in SQL is used to combine multiple conditions in a query. All conditions connected with AND must be true for a row to be included in the result. It allows users to filter records based on multiple criteria.

17.What is the OR operator in SQL?

The OR operator in SQL is used to combine multiple conditions in a query. If any condition connected by OR is true, the row is included in the result. It provides more flexibility when specifying alternative conditions in a query.

18.What is the distinct keyword ?

The DISTINCT keyword in SQL is used to return only unique (non-duplicate) values from a column or a set of columns. It helps eliminate duplicate rows in the result set and is typically used with the SELECT statement to retrieve unique data.

19.What is the ORDER BY clause in SQL?

The ORDER BY clause in SQL is used to sort the result set of a query. It allows sorting based on one or more columns in either ascending (ASC) or descending (DESC) order, providing control over the order in which the data is returned.

20.What is ALTER TABLE statement?

The ALTER TABLE statement is used to modify an existing table's structure. It allows users to add, delete, or modify columns and constraints within the table. This command helps update a table's schema without needing to recreate the table.

21.What is the DROP TABLE statement?

The DROP TABLE statement is used to delete an entire table and its data from the database. This action is irreversible, and once a table is dropped, all the data stored in the table is lost permanently.

22.What is constraint in SQL?

A constraint in SQL is a rule that limits the type of data that can be inserted or modified in a table. Constraints help maintain data integrity by enforcing rules such as uniqueness, non-nullability, and referential integrity, e.g., PRIMARY KEY, FOREIGN KEY, and CHECK.

23.What is NOT NULL constraint?

The NOT NULL constraint in SQL ensures that a column cannot have NULL values. It is used to enforce that a specific column must always contain a valid value when a new record is inserted or an existing record is updated.

24.What is UNIQUE constraint?

The UNIQUE constraint ensures that all values in a column are distinct across the table. It prevents duplicate entries in the specified column and can be applied to one or more columns, ensuring data integrity.

25.What is CHECK constraint?

The CHECK constraint in SQL is used to limit the range or type of values that can be entered into a column. It ensures that data satisfies a specific condition or logical expression, such as enforcing that a price column only accepts positive numbers.

26.What is DEFAULT constraint?

The DEFAULT constraint provides a default value for a column when no value is specified during record insertion. It helps ensure that columns have a predefined value, reducing the chances of NULL values unless explicitly set.

27.What is the use of IN operator?

The IN operator in SQL is used to check if a value matches any value in a specified list or subquery. It simplifies multiple OR conditions and is used in WHERE clauses to filter results based on a range of possible values.

28.What is the use of BETWEEN operator?

The BETWEEN operator in SQL is used to filter records within a specific range. It is commonly used in WHERE clauses to select values that fall between a given range, including the boundary values. It can be used with numeric, date, or text data types.

29.What is the use of IS NULL operator?

The IS NULL operator in SQL is used to check whether a column contains NULL values. It is used in the WHERE clause to filter rows where the specified column has no value, indicating missing or unknown data.

30.What does the truncate command do in SQL?

The TRUNCATE command in SQL is used to remove all records from a table without deleting the table itself. Unlike DELETE, TRUNCATE is faster and does not log individual row deletions. It also resets auto-increment counters to their starting value.

31.What is the use of DROP DATABSE command?

The DROP DATABASE command is used to delete an entire database along with its objects (tables, views, procedures, etc.). This operation is irreversible and permanently removes all data and structure, freeing up the associated storage.

32.What is the difference between DROP and TRUNCATE?

DROP removes a table (or database) entirely from the database system, including its structure and data. TRUNCATE removes all data from a table but keeps its structure intact, allowing for future data insertion. DROP is more destructive than TRUNCATE.

33.What is the use of column alias in SQL?

A column alias in SQL is a temporary name assigned to a column or expression in the result set. It is used to improve readability and clarity of query results, especially when using functions or complex expressions. The alias is defined using the AS keyword.