1.
Which commands are used to define or redefine schema objects?
Correct Answer
A. DDL
Explanation
DDL stands for Data Definition Language and is used to define or redefine schema objects in a database. This includes creating, altering, and dropping tables, views, indexes, and other database objects. DDL commands are used to define the structure of the database and its objects, such as defining the columns and data types of a table. Therefore, the correct answer is DDL.
2.
Which is a valid CREATE TABLE statement?
Correct Answer
D. Create table emp (id integer(3));
Explanation
The correct answer is "Create table emp (id integer(3));". This is a valid CREATE TABLE statement because it follows the correct syntax for creating a table named "emp" with a column "id" of data type "integer" and a length of 3.
3.
How can you insert a new row into the “STORE” table.
Correct Answer
D. INSERT INTO STORE VALUES (1,‟ RAM SINGH‟);
Explanation
The correct answer is "INSERT INTO STORE VALUES (1,‟ RAM SINGH‟);" because it follows the correct syntax for inserting a new row into a table. The "INSERT INTO" statement is used to specify the table name, followed by the "VALUES" keyword to indicate the values to be inserted. The values are then enclosed in parentheses and separated by commas.
4.
Conditionally retrieval of rows from a table with SELECT, which clause is used?
Correct Answer
A. Where
Explanation
The "WHERE" clause is used for conditionally retrieving rows from a table with the SELECT statement. It allows you to specify conditions that the retrieved rows must meet in order to be included in the result set. The WHERE clause is followed by a condition that evaluates to true or false for each row in the table, and only the rows that satisfy the condition are returned in the result set. This clause is essential for filtering and narrowing down the data that is retrieved from the table.
5.
The ……………. keyword eliminates duplicate rows from the result of a SELECT statement.
Correct Answer
C. Distinct
Explanation
The "Distinct" keyword eliminates duplicate rows from the result of a SELECT statement. When used in a query, it ensures that only unique values are returned, removing any duplicate rows that may be present in the result set. This is helpful when you want to retrieve only unique records from a table or when you need to perform calculations or analysis on distinct values.
6.
Which operator defines a range of values that the column values must fall in?
Correct Answer
C. Between
Explanation
The operator "Between" is used to define a range of values that the column values must fall in. It is typically used in SQL queries to specify a range for a particular column. For example, "SELECT * FROM table WHERE column BETWEEN value1 AND value2" will retrieve all rows where the column value falls between value1 and value2.
7.
To specify a list of values …………. Operator is used.
Correct Answer
A. IN
Explanation
The IN operator is used to specify a list of values. It allows you to check if a value matches any value in a list. For example, if you have a list of cities (New York, London, Paris) and you want to retrieve all the rows where the city is either New York or Paris, you can use the IN operator. This operator simplifies the query and makes it more efficient compared to using multiple OR conditions.
8.
Which SQL statement will not generate any error message?
Correct Answer
C. SELECT * FROM EMP WHERE COMM IS NOT NULL;
Explanation
The SQL statement "SELECT * FROM EMP WHERE COMM IS NOT NULL;" will not generate any error message because it is a valid query that retrieves all records from the EMP table where the COMM column is not null. The other options in the question have syntax errors that would result in error messages.
9.
Which statement is valid?
Correct Answer
D. ALTER TABLE EMPLOYEE MODIFY (last_name VARCHAR2 (2000));
Explanation
The correct answer is "ALTER TABLE EMPLOYEE MODIFY (last_name VARCHAR2 (2000));". This statement is valid because it uses the correct syntax to modify the column "last_name" in the table "EMPLOYEE" to have a maximum length of 2000 characters using the VARCHAR2 data type. The other statements either use incorrect syntax or incorrect data types.
10.
The clause which sorts data of table.
Correct Answer
C. Order by Clause
Explanation
The Order by clause is used to sort the data of a table in a specific order. It allows you to arrange the result set in ascending or descending order based on one or more columns. This clause is commonly used in conjunction with the Select statement to organize the output according to certain criteria. By specifying the column(s) to sort by and the desired order, you can easily arrange the data in a meaningful way for analysis or presentation.
11.
Which of the following commands should be used to create a database named “student”?
Correct Answer
B. CREATE DATABASE student
Explanation
The correct answer is "CREATE DATABASE student" because the "CREATE DATABASE" command is used to create a new database, and "student" is the name specified for the new database.
12.
Which one will delete the table data as well as the table structure?
Correct Answer
A. DROP
Explanation
DROP is the correct answer because it is a SQL command used to delete both the table data and the table structure. When the DROP command is executed on a table, it removes the entire table from the database, including all the data and the structure of the table. This operation cannot be undone, so it should be used with caution.
13.
Full form of RDBMS is
Correct Answer
B. Relational database management system
Explanation
The correct answer is "Relational database management system". RDBMS stands for Relational Database Management System, which is a software system that allows users to create, manage, and manipulate relational databases. It is a widely used approach for organizing and storing data in a structured manner, using tables with rows and columns to represent entities and their relationships. RDBMSs provide a set of tools and features for data storage, retrieval, and manipulation, ensuring data integrity and consistency.
14.
The USE command?
Correct Answer
D. Should be used to choose the database you want to use once you've connected to MySQL
Explanation
The USE command should be used to choose the database you want to use once you've connected to MySQL. This command allows you to switch to a specific database and perform operations on it. It is important to select the appropriate database before executing any queries to ensure that the operations are performed on the correct database.
15.
A row of relation is generally referred to as ……….. and a column of a relation is …………
Correct Answer
C. Tuple & Attribute
Explanation
A row in a relation is commonly referred to as a tuple, while a column is referred to as an attribute.
16.
A relation has 45 tuples & 5 attributes. What will be the Degree and Cardinality of that relation?
Correct Answer
A. Degree 5, Cardinality 45
Explanation
The degree of a relation refers to the number of attributes or columns in the relation. In this case, the relation has 5 attributes, so the degree is 5. The cardinality of a relation refers to the number of tuples or rows in the relation. Here, the relation has 45 tuples, so the cardinality is 45.
17.
We use …………… operator with select for condition based on pattern matching.
Correct Answer
B. LIKE
Explanation
The LIKE operator is used with SELECT for conditions based on pattern matching. It allows us to search for a specified pattern within a column. It uses wildcard characters such as % (represents zero or more characters) and _ (represents a single character) to match patterns. This operator is commonly used in SQL queries to filter and retrieve data based on specific patterns or values.
18.
To display the detail of employee having „e‟ in their name in descending order of salary the correct SQL statement is :
Correct Answer
D. SELECT * FROM emp WHERE ename LIKE „%e%‟ ORDER BY SAL DESC;
Explanation
The correct SQL statement is "SELECT * FROM emp WHERE ename LIKE '%e%' ORDER BY SAL DESC;" This statement selects all the columns from the "emp" table where the "ename" column contains the letter "e" anywhere in the name. It then orders the result in descending order of the "SAL" column.
19.
_________is the attribute or group of attributes that uniquely identify occurrence of each entity.
Correct Answer
C. Primary Key
Explanation
A primary key is the attribute or group of attributes that uniquely identify each occurrence of an entity. It serves as a unique identifier for each record in a database table, ensuring that no two records have the same key value. This key is crucial for maintaining data integrity and establishing relationships between tables in a relational database system. By defining a primary key, we can enforce uniqueness and facilitate efficient data retrieval and manipulation operations.
20.
A non-key attribute whose values are derived from the primary key of some other table.
Correct Answer
B. Foreign key
Explanation
A foreign key is a non-key attribute that is derived from the primary key of another table. It establishes a relationship between two tables by referencing the primary key of one table in another table. This allows for data consistency and integrity, as it ensures that the values in the foreign key column correspond to existing values in the referenced primary key column.