Start of Database Management with SQL Programming Quiz
1. What is the full form of DBMS?
- Database Management System
- Digital Base Management System
- Data Block Management System
- Dynamic Bytes Management System
2. What is a database?
- An organized collection of data or information that can be accessed, updated, and managed.
- A method for designing graphical user interfaces for applications.
- A program used for editing text files and documents.
- A type of hardware device for storing files and applications.
3. What is DBMS?
- Data Base Management Server
- Database Management System
- Digital Backup Management Software
- Data Block Management System
4. Which of the following is not a utility of DBMS?
- Data storage
- Data manipulation
- Data retrieval
- Processing
5. What does a foreign key combined with a primary key create?
- A primary key that duplicates existing data.
- A combined index that speeds up queries.
- A composite key that maintains transactional integrity and consistency.
- A foreign key that creates a new table.
6. What is the function of the command `DELETE FROM r WHERE P;`?
- Updates a specific tuple in relation r based on the condition P.
- Selects all tuples from relation r that meet the condition P.
- Deletes a particular tuple from relation r based on the condition P.
- Inserts a new tuple into relation r based on the condition P.
7. Which of the following commands is used to create a new table in SQL?
- MAKE TABLE
- NEW TABLE
- CREATE TABLE
- ADD TABLE
8. What does the following statement in SQL do? `DROP TABLE student;`
- Renames the table `student` to something else.
- Deletes the entire table named `student` and all its data.
- Creates a new table named `student`.
- Modifies the existing table named `student`.
9. Which of the following are types of Unicode character string types in SQL?
- NCHAR, NVARCHAR, CHAR, VARCHAR
- STRING, TEXT, BYTE, BLOB
- INT, FLOAT, DOUBLE, REAL
- BOOLEAN, SET, DATE, TIME
10. What does BLOB in SQL stand for?
- Binary Linked Object
- Basic Log Object
- Binary List Object
- Binary Large OBject
11. Which of the following datatype is most appropriate for storing a string of up to 255 characters?
- NCHAR(255)
- CHAR(255)
- TEXT(255)
- VARCHAR(255)
12. What happens when no value is inserted in an ENUM list?
- No value is inserted, resulting in an error.
- All entries in the ENUM list become inactive.
- The default value specified in the ENUM list is used.
- The ENUM list ignores the input and returns null.
13. What is the range of integers that can be held in the MEDIUMINT datatype of SQL?
- -8388608 to 8388607
- -2147483648 to 2147483647
- 0 to 65535
- -32768 to 32767
14. What does the following code snippet do? `ALTER TABLE STUDENT ADD(ADDRESS VARCHAR2(20));`
- Adds a new column named `ADDRESS` of type VARCHAR2(20) to the table `STUDENT`.
- Modifies the data type of `ADDRESS` in the `STUDENT` table.
- Creates a new table named `ADDRESS` in the database.
- Deletes the `ADDRESS` column from the table `STUDENT`.
15. Which of the following commands is used to delete all rows and free up space from a table?
- DELETE ALL
- TRUNCATE TABLE
- DROP TABLE
- REMOVE RECORDS
16. Which of the following commands are a part of Data Control Language?
- UNION, INTERSECT, EXCEPT
- COMMIT, ROLLBACK, SAVEPOINT
- CREATE, DROP, ALTER
- SELECT, INSERT, UPDATE
17. What does the following code snippet do? `DELETE FROM STUDENTS WHERE AGE = 16; ROLLBACK;`
- Just rolls back the last transaction without any effect on the `STUDENTS` table.
- Deletes rows from the table `STUDENTS` where AGE is 16, but then rolls back the transaction to undo the deletion.
- Modifies the AGE of students in the `STUDENTS` table to 16.
- Permanently deletes all rows from the `STUDENTS` table where AGE equals 16.
18. When is the wildcard in the WHERE clause used?
- To match any number of characters in a string.
- To match a specific character only.
- To sort the results in a specific order.
- To limit the number of results returned.
19. Which SQL constraint do we use to set some value to a field whose value has no default?
- UNIQUE constraint
- PRIMARY KEY constraint
- NOT NULL constraint
- FOREIGN KEY constraint
20. What is the difference between local and global variables in SQL?
- Local variables are defined at the database level, while global variables are defined at the table level.
- Local variables are stored in the database, while global variables are temporary.
- Local variables are accessible only within the current session, while global variables are accessible throughout the entire program.
- Local variables can be accessed in multiple sessions, while global variables are session-specific.
21. By default, what is the order of the ORDER BY statement in SQL?
- Ascending order.
- Unordered.
- Descending order.
- Random order.
22. How do you change the order of the ORDER BY statement in SQL to descending?
- Include ORDER BY DESC only.
- Use the ASC function.
- Add the DESC keyword.
- Replace ORDER BY with DESC.
23. What set operators do you know in SQL?
- ADD, SUBTRACT, MULTIPLY, DIVIDE
- OUTPUT, INPUT, PROCESS, NAVIGATE
- UNION, UNION ALL, INTERSECT, EXCEPT
- SELECT, UPDATE, DELETE, INSERT
24. What operator is used in the query for pattern matching in SQL?
- MATCH operator with * and ? wildcards.
- LIKE operator with % and _ wildcards.
- FIND operator with ^ and & symbols.
- SEARCH operator with # and @ symbols.
25. What is the difference between a primary key and a unique key in SQL?
- A primary key can accept null values, while a unique key cannot.
- A primary key can have duplicate values, while a unique key cannot.
- A primary key is used only for foreign key relationships, while a unique key is not.
- A primary key uniquely identifies each row in a table, while a unique key uniquely identifies each value in a column.
26. How do you rename a column of a table in SQL?
- Using the UPDATE TABLE statement with SET COLUMN.
- Using the CHANGE TABLE statement with ALTER COLUMN.
- Using the MODIFY TABLE statement with CHANGE COLUMN.
- Using the ALTER TABLE statement with RENAME COLUMN.
27. How do you delete a column from a table in SQL?
- Dropping the entire database and recreating the table.
- Using the DELETE statement on the entire column.
- Updating the column to null values only.
- Using the ALTER TABLE statement with DROP COLUMN.
28. How do you select all even or all odd records in a table in SQL?
- Using the SUM function.
- Using the AVG function.
- Using the COUNT function.
- Using the MOD function or modulo operator (%).
29. How do you prevent duplicate records when making a query in SQL?
- Using the ORDER BY clause with DESC.
- Using the DISTINCT statement or creating a unique key.
- Using the LIMIT clause in the query.
- Using the GROUP BY statement on all fields.
30. How do you insert many rows in a table in SQL?
- Using the INSERT INTO statement with VALUES.
- Using the DELETE statement to create rows.
- Using the UPDATE statement to add rows.
- Using the SELECT statement to append rows.
Congratulations! You’ve Successfully Completed the Quiz
Well done on completing the quiz on Database Management with SQL Programming! This journey has not only tested your knowledge but also expanded your understanding of key concepts in database management. You have delved into essential topics such as SQL syntax, queries, and database structures. These skills are vital for anyone looking to work with data effectively.
Throughout the quiz, you likely discovered the importance of structured data manipulation. You learned how to create, read, update, and delete data using SQL commands. This fundamental understanding is crucial for any aspiring database administrator or data analyst. Remember, mastering these skills opens up new opportunities in the tech world.
If you enjoyed this quiz and want to deepen your understanding, we invite you to explore the next section on this page. It’s packed with valuable information about Database Management with SQL Programming. Whether you’re a beginner or looking to refine your skills, this resource will enhance your knowledge further. Happy learning!
Database Management with SQL Programming
Overview of Database Management Systems
Database Management Systems (DBMS) are software applications that interact with end-users, applications, and the database itself. They manage data storage, retrieval, and updating efficiently. A DBMS provides functionalities such as data security, backup, and data integrity. Common types include relational, NoSQL, and object-oriented databases, each designed for specific use cases. The relational model, which uses tables to represent data, is particularly dominant due to its logical approach to data relations.
Introduction to SQL Programming
Structured Query Language (SQL) is the standard programming language used to manage and manipulate relational databases. SQL allows users to perform tasks such as querying data, updating existing records, and creating new tables. Key SQL commands include SELECT for data retrieval, INSERT for adding new records, UPDATE for modifying existing entries, and DELETE for removing data. SQL’s declarative nature enables users to specify what data they need without detailing how to retrieve it.
Core SQL Commands and Their Functions
Core SQL commands are categorized into Data Query Language (DQL), Data Definition Language (DDL), and Data Manipulation Language (DML). DQL includes the SELECT statement for retrieving data from one or more tables. DDL commands like CREATE, ALTER, and DROP are essential for defining and modifying the database structure. DML commands, including INSERT, UPDATE, and DELETE, handle data manipulation tasks. Each command serves a specific role in maintaining and interacting with the database.
Database Normalization Techniques
Database normalization is the process of organizing data to minimize redundancy. It involves dividing large tables into smaller, interrelated tables and defining relationships between them. Normal forms, ranging from First Normal Form (1NF) to Fifth Normal Form (5NF), provide guidelines for structuring databases. Normalization improves data integrity and ensures that updates, deletions, and insertions do not cause anomalies within relational data. Proper normalization simplifies database management and enhances query performance.
SQL Optimization and Performance Tuning
SQL optimization involves improving the performance of SQL queries and database operations. Techniques include indexing, which speeds up data retrieval by creating pointers to data locations, and query rewriting for more efficient execution paths. Analyzing query execution plans helps identify bottlenecks in performance. Additionally, proper schema design and regular maintenance tasks like database statistics updates further improve performance. Effective optimization leads to quicker response times and efficient resource utilization.
What is SQL?
SQL, or Structured Query Language, is a standardized programming language used for managing and manipulating relational databases. It allows users to create, read, update, and delete data within a database. SQL is essential for performing operations such as querying data, creating database schema, and controlling access to the data. Its standardization is endorsed by the American National Standards Institute (ANSI), ensuring consistency across different database systems.
How does SQL manage data?
SQL manages data through a series of commands that interact with the database. These commands include SELECT for retrieving data, INSERT for adding new records, UPDATE for modifying existing records, and DELETE for removing records. Each command operates on structured data stored in tables, allowing for efficient data retrieval and manipulation. SQL’s relational model allows for complex queries that can join data from multiple tables accurately.
Where is SQL commonly used?
SQL is commonly used in various applications where relational databases are implemented. This includes business applications, e-commerce platforms, data analytics, and content management systems. Major relational database management systems (RDBMS) like MySQL, PostgreSQL, Oracle, and Microsoft SQL Server utilize SQL for managing their data. Its prevalence in handling structured data makes it a fundamental tool for developers and analysts.
When was SQL developed?
SQL was developed in the early 1970s, with its initial version created by Donald D. Knuth and later by IBM researchers, including Raymond F. Boyce and Donald D. Chamberlin. The first commercial implementation of SQL appeared in 1979 with the release of the Oracle database. Since then, SQL has evolved through updates and new standards, with SQL-92 and SQL:2016 being notable revisions that introduced new features and functionalities.
Who uses SQL?
SQL is used by database administrators, software developers, data analysts, and business intelligence professionals. These users employ SQL to manage databases, analyze data sets, and develop data-driven applications. Organizations across various industries, including finance, healthcare, and technology, leverage SQL to support their data management needs and drive decision-making processes. Its widespread use is rooted in its efficiency and capability to handle large volumes of data.