0% found this document useful (0 votes)
2 views2 pages

Solved IP Worksheet

The document contains a worksheet with questions and answers related to SQL concepts, including primary keys, SQL commands, data types, and constraints. It covers topics such as table structure modification, data integrity, and database advantages over file systems. Additionally, it provides examples of SQL queries for various operations on tables like INSERT, UPDATE, and DELETE.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Solved IP Worksheet

The document contains a worksheet with questions and answers related to SQL concepts, including primary keys, SQL commands, data types, and constraints. It covers topics such as table structure modification, data integrity, and database advantages over file systems. Additionally, it provides examples of SQL queries for various operations on tables like INSERT, UPDATE, and DELETE.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SOLVED WORKSHEET – IP

Q1. Which of the following ensures uniqueness of every row in a table?


Answer: b) Primary key

Q2. Which SQL command is used to change the structure of an existing table?
Answer: c) ALTER

Q3. The number of rows in a table is known as its:


Answer: b) Cardinality

Q4. Which SQL clause is used to arrange the result set?


Answer: a) ORDER BY

Q5. To display records where the city starts with ‘A’ we use:
Answer: c) City LIKE 'A%'

Q6. Which SQL keyword is used to remove an entire table?


Answer: b) DROP

Q7. When a primary key from one table appears in another table, it becomes the:
Answer: b) Foreign key

Q8. Which is NOT a valid SQL data type?


Answer: d) INTEGER32

Q9. DCL stands for:


Answer: a) Data Control Language

Q10. A column that can accept NULL values is:


Answer: d) AUTO INCREMENT

Q11. Differences between Primary Key and Unique Key:


- Primary Key: Cannot have NULL values.
- Unique Key: Can have one NULL value.

Q12. Constraints in SQL:


Constraints are rules applied to columns to maintain data integrity.
Examples: PRIMARY KEY, NOT NULL, UNIQUE, CHECK.

Q13.
DDL command example: CREATE TABLE Students (...);
DML command example: INSERT INTO Students VALUES (...);

Q14. Reasons databases are preferred over file systems:


- Better data security
- Reduced data redundancy

Q15. Use of WHERE clause:


Used to filter rows based on a condition.
Example: SELECT * FROM Students WHERE City = 'Delhi';
Q16. SQL command to create table COURSE:
CREATE TABLE COURSE (
CID INT PRIMARY KEY,
CName VARCHAR(30),
Duration INT,
Fees INT
);

Q17. SALES table queries:


a) INSERT INTO SALES VALUES (401, 'Keyboard', 1800, 'June');
b) UPDATE SALES SET Amount = 2500 WHERE SaleID = 301;
c) DELETE FROM SALES WHERE Month = 'April';

Q18. Definitions:
Cardinality: Number of rows in a table.
Degree: Number of columns in a table.
Relation: A table in RDBMS.

Q19. SQL numeric data types:


INT, DECIMAL(5,2), FLOAT.

Q20. COURSE & DEPARTMENT:


a) Foreign key: DeptID in COURSE.
b) Primary keys: CourseID, DeptID.
c) SELECT CourseName, Fees FROM COURSE WHERE DeptID = 10;
d) SELECT * FROM COURSE WHERE Duration BETWEEN 6 AND 12;

Q21. PRODUCT table queries:


a) UPDATE PRODUCT SET Price = Price + (Price * 0.10) WHERE Category = 'Stationery';
b) SELECT PName FROM PRODUCT WHERE Price > 50;
c) ALTER TABLE PRODUCT ADD Supplier VARCHAR(30);
d) DELETE FROM PRODUCT WHERE PID = 303;

You might also like