1.
SQL < select name ,sal from Emp where name like m%;
Correct Answer
B. False
Explanation
The given SQL statement selects the columns "name" and "sal" from the table "Emp" where the name starts with the letter "m". The correct answer is False because the SQL statement is incorrect. The "%" wildcard character should be enclosed in single quotes ('%') to indicate a pattern match. So, the correct SQL statement should be "SELECT name, sal FROM Emp WHERE name LIKE 'm%';".
2.
SQL < select name , job from Emp where sal < = 25000 or job = sales ;
Correct Answer
B. False
Explanation
The given SQL statement selects the name and job columns from the Emp table where either the sal column is less than or equal to 25000 or the job column is equal to "sales". Therefore, the correct answer is False because the statement is selecting records that meet either one of the conditions, not both.
3.
SQL < select name , job from Emp where sal < = 25000 or job = 'sales' ;
Correct Answer
A. True
Explanation
The given SQL query selects the name and job columns from the Emp table where the salary is less than or equal to 25000 or the job is 'sales'. Since the query is selecting rows that meet either of these conditions, it will return true.
4.
SQL < select * from Emp where sal between 1000 and 2000.
Correct Answer
B. False
Explanation
The given SQL statement selects all the records from the "Emp" table where the "sal" column value is between 1000 and 2000. Since the statement does not specify any particular condition or constraint, it will return all the records that meet this criteria. Therefore, the correct answer is False, as the statement is not selecting a specific record or condition.
5.
SQL < select * from Emp where sal between 1000 and 2000 ;
Correct Answer
A. True
Explanation
The given SQL statement selects all the records from the "Emp" table where the "sal" column value is between 1000 and 2000. Since the statement is valid and will retrieve records based on the given condition, the correct answer is "True".
6.
SQL < select * where sal between 1000 and 2000 ;
Correct Answer
B. False
Explanation
The given SQL statement is incorrect because it is missing the "FROM" clause. The correct syntax should be "SELECT * FROM table_name WHERE sal BETWEEN 1000 AND 2000;". Therefore, the correct answer is False.
7.
SQL < select * from Emp where sal between 1000 and 2000 ;
Correct Answer
A. True
Explanation
The given SQL query selects all the rows from the "Emp" table where the "sal" column has a value between 1000 and 2000. Since the query is valid and will return a result, the correct answer is "True".
8.
SQL < select * from Emp where sal 1000 and 2000 ;
Correct Answer
B. False
Explanation
The given SQL statement is not written correctly. The correct syntax for selecting records based on a range of values in the "sal" column would be "SELECT * FROM Emp WHERE sal BETWEEN 1000 AND 2000;". Therefore, the correct answer is False.
9.
SQL < select * from Emp where sal between 1000 and 2000 ;
Correct Answer
A. True
Explanation
The SQL statement "select * from Emp where sal between 1000 and 2000" is used to retrieve all the records from the table "Emp" where the salary is between 1000 and 2000. Since the statement is valid and can be executed without any errors, the correct answer is "True".
10.
SQL < select name ,sal from Emp where name like 'm%';
Correct Answer
A. True
Explanation
The SQL query selects the "name" and "sal" columns from the "Emp" table where the "name" column starts with the letter "m". Since the query is valid and will return a result, the correct answer is "True".
11.
SQL < select name , job from Emp where sal < = 25000 or job = 'sales' ;
Correct Answer
A. True
Explanation
The given SQL statement selects the columns "name" and "job" from the "Emp" table where the salary is less than or equal to 25000 or the job is "sales". Since the statement is valid and will return a result, the correct answer is True.
12.
SQL < select name , job from Emp where sal < = 25000 or job =sales ;
Correct Answer
B. False
Explanation
The given SQL query selects the name and job columns from the Emp table where the salary is less than or equal to 25000 or the job is equal to "sales". Since the query has an "or" condition, it will return all the rows that satisfy either of the conditions. Therefore, the answer is false, indicating that the statement is incorrect.
13.
SQL < select * from Emp where sal between 1000 and 2000 ;
Correct Answer
A. True
Explanation
This SQL statement selects all the rows from the "Emp" table where the "sal" column value is between 1000 and 2000. Therefore, the correct answer is "True" because the statement is valid and will return the desired results.
14.
SQL < select name , sal from Emp name like '-a%' ;
Correct Answer
B. False
Explanation
The given SQL statement is incorrect. The correct syntax for selecting columns "name" and "sal" from the table "Emp" where the name starts with "-a" would be: "SELECT name, sal FROM Emp WHERE name LIKE '-a%'. Therefore, the correct answer is False.
15.
SQL < select name , job , sal from emp where job = 'sales' and sal < 1500;
Correct Answer
A. True
Explanation
The given SQL statement selects the name, job, and salary of employees from the "emp" table where the job is "sales" and the salary is less than 1500. If there are any employees who satisfy both conditions, the statement will return true.
16.
SQL < select min sal , max (sal) from emp;
Correct Answer
B. False
Explanation
The given SQL statement selects the minimum salary and the maximum salary from the "emp" table. Therefore, the correct answer is False, as the statement is syntactically incorrect. The "max" function should be used without parentheses, like "max(sal)", instead of "max (sal)".
17.
SQL < select name , job , sal from emp where (job='sales' or job = 'clerk') and sal < 1700 ;
Correct Answer
A. True
Explanation
The given SQL query selects the name, job, and salary of employees from the "emp" table where their job is either "sales" or "clerk" and their salary is less than 1700. Since the query is selecting specific columns and applying conditions on the job and salary, it is expected to return a result. Therefore, the correct answer is "True".
18.
SQL < select name , sal + 300 from emp
Correct Answer
B. False
Explanation
The given SQL statement selects the "name" column and adds 300 to the "sal" column from the "emp" table. Therefore, the correct answer is False.
19.
DDL is SQL commands that allows the creating, alteration, and dropping of an object from the database.
Correct Answer
A. True
Explanation
The statement is true because DDL (Data Definition Language) is indeed a set of SQL commands that are used to create, modify, and delete database objects such as tables, indexes, and views. These commands include CREATE, ALTER, and DROP, which respectively allow the creation, alteration, and dropping of objects from the database. Therefore, the given statement accurately describes DDL commands and their purpose.
20.
Definition of DML is SQL commands allow the inserting, updating, and deletion of objects from the database.
Correct Answer
A. True
Explanation
The given statement is true. DML (Data Manipulation Language) in SQL allows the insertion of new data into the database, updating existing data, and deleting unwanted data from the database. It includes commands such as INSERT, UPDATE, and DELETE, which are used to perform these operations on the database objects. Therefore, the statement accurately defines the purpose of DML in SQL.
21.
Definition of Dcl is SQL commands allow certain DML commands to be undone.
Correct Answer
B. False
Explanation
The given statement is false. Dcl (Data Control Language) in SQL is used to control access to the database and perform administrative tasks. It includes commands like GRANT, REVOKE, and DENY, which are used to grant or revoke privileges on database objects. DML (Data Manipulation Language) commands like INSERT, UPDATE, and DELETE are used to modify data in the database and cannot be undone using Dcl commands. Therefore, the statement that Dcl commands allow certain DML commands to be undone is incorrect.
22.
A null is not the same as zero or a blank space.
Correct Answer
A. True
Explanation
A null refers to the absence of a value, while zero represents a numerical value and a blank space represents an empty character. Therefore, a null is different from both zero and a blank space.
23.
SQL is Is based on American National Standards Institute ( ANSI ) standard SQL.
Correct Answer
A. True
Explanation
The given statement is true because SQL, which stands for Structured Query Language, is indeed based on the American National Standards Institute (ANSI) standard SQL. This standard ensures that SQL is consistent and compatible across different database management systems, allowing for portability and interoperability of SQL code.
24.
SQL Can be abbreviated.
Correct Answer
B. False
Explanation
SQL cannot be abbreviated. It stands for Structured Query Language and is a programming language used for managing relational databases. Abbreviating SQL would result in a different term altogether and would not accurately represent the purpose and functionality of the language. Therefore, the correct answer is False.
25.
SQL Is Manipulates data and table definitions in the data base.
Correct Answer
A. True
Explanation
The statement is true because SQL (Structured Query Language) is a programming language that is used to manipulate and manage data and table definitions in a database. It is specifically designed for managing relational databases and allows users to perform tasks such as inserting, updating, deleting, and retrieving data from tables. SQL is widely used in the field of database management systems and is essential for working with databases effectively.