1.
SQL < select name ,sal from Emp where name like m%;
Correct Answer
B. False
Explanation
The given SQL statement is incorrect because the string "m%" is not enclosed in quotes. In SQL, string literals should be enclosed in single quotes. Therefore, the correct syntax for the statement would be "SELECT name, sal FROM Emp WHERE name LIKE 'm%'" to search for names starting with the letter "m". Since the given statement is incorrect, the correct answer is False.
2.
SQL < select name , job from Emp where sal < = 25000 or job = sales ;
Correct Answer
B. False
Explanation
The given SQL statement selects the columns "name" and "job" from the table "Emp" where the salary is less than or equal to 25000 or the job is "sales". The correct answer is False because the statement is syntactically incorrect. In SQL, the less than or equal to operator is written as "
3.
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 the salary is less than or equal to 25000 or the job is 'sales'. The correct answer is False because the statement is not complete and does not provide a valid SQL query.
4.
SQL < select * from Emp where sal between 1000 and 2000
Correct Answer
B. False
Explanation
The given SQL statement selects all records from the "Emp" table where the "sal" column is between 1000 and 2000. Since the statement is selecting records based on a specific condition, it will return a subset of the data in the table, not all records. Therefore, the correct answer is False.
5.
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.
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 SQL statement "select * from Emp where sal between 1000 and 2000" will return all records from the "Emp" table where the "sal" column value is between 1000 and 2000. Therefore, the answer "True" is correct as the statement will indeed retrieve the desired records.
8.
SQL < select * from Emp where sal 1000 and 2000 ;
Correct Answer
B. False
Explanation
This statement is not a valid SQL query. The correct syntax for the WHERE clause in SQL is to use comparison operators such as "=", "", "=", or "". In this case, the query is missing the comparison operator between "sal" and the values 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 given SQL statement selects all the records from the "Emp" table where the "sal" column value falls between 1000 and 2000. Therefore, the answer "True" indicates that the statement is correct and will retrieve the desired records.
10.
SQL < select name ,sal from Emp where name like 'm%';
Correct Answer
A. True
Explanation
The given SQL statement selects the name and salary columns from the Emp table where the name starts with the letter 'm'. Since the statement is syntactically correct and will return the desired result, the correct answer is true.
11.
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 the salary is less than or equal to 25000 or the job is 'sales'. The correct answer is False because the statement is syntactically incorrect. The less than or equal to operator should be written as '
12.
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 the salary is greater than or equal to 25000 or the job is equal to "sales". Since the statement is selecting records where either of the conditions is true, the answer is false.
13.
SQL < select * from Emp where sal between 1000 and 2000 ;
Correct Answer
A. True
Explanation
The given SQL statement selects all the rows from the "Emp" table where the value in the "sal" column is between 1000 and 2000. Since the statement is valid and will return a result, the correct answer is True.
14.
SQL < select name , sal from Emp name like '-a%' ;
Correct Answer
B. False
Explanation
The given SQL statement selects the columns "name" and "sal" from the table "Emp" where the "name" starts with "-a". Since there is a syntax error in the statement (the keyword "like" is missing), 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 columns "name", "job", and "sal" from the table "emp" where the job is "sales" and the salary is greater than 1500. Since the statement is valid and can be executed without any errors, the answer is true.
16.
SQL < select min sal , max (sal) from emp;
Correct Answer
B. False
Explanation
The given SQL statement is incorrect because there is a syntax error. The "max" function should not have a space between "max" and the opening parenthesis. The correct syntax should be "max(sal)". Therefore, the correct answer is False.
17.
SQL < select name , job , sal from emp where (job='sales' or job = 'clerk') and sal < 1700 ;
Correct Answer
A. True
Explanation
The SQL query is selecting 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 valid and will return a result, the 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. Since there is no "FROM" clause specified in the statement, it is not a valid SQL syntax. Therefore, the correct answer is False.
19.
DDL is SQL commands allows the creating , alteration , and dropping of object from the database.
Correct Answer
A. True
Explanation
DDL stands for Data Definition Language, and it is a set of SQL commands used to define and manage the structure of a database. These commands include creating tables, altering table structures, and dropping tables or other objects from the database. Therefore, the statement that DDL allows creating, altering, and dropping objects from the database is true.
20.
Definition of DML is SQL commands allow the inserting , updating , and deletion of objects from the database.
Correct Answer
A. True
Explanation
The statement is true because DML (Data Manipulation Language) in SQL is used to modify and manipulate data in a database. It includes commands like INSERT, UPDATE, and DELETE, which allow for the insertion, updating, and deletion of objects from the database. Therefore, the given 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 definition of Dcl is incorrect. Dcl stands for Data Control Language, which is a subset of SQL commands that are used to control access to the database. Dcl commands are used to grant or revoke privileges, such as granting or revoking the ability to select, insert, update, or delete data in a database. Dcl commands do not have the ability to undo DML (Data Manipulation Language) commands. Therefore, the correct answer is False.
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 not the same as zero or a blank space, making the statement true.
23.
SQL is Is based on American National Standards Institute ( ANSI ) standard SQL
Correct Answer
A. True
Explanation
The statement is true because SQL (Structured Query Language) is indeed based on the American National Standards Institute (ANSI) standard SQL. ANSI is responsible for developing and maintaining standards in various industries, including computer science. In the case of SQL, ANSI has established a standard that defines the syntax and functionality of the language, ensuring compatibility and interoperability across different database management systems. This standardization allows SQL queries and commands to be written and executed consistently across different platforms and databases.
24.
SQL Can be abbreviated
Correct Answer
B. False
Explanation
SQL cannot be abbreviated. It stands for Structured Query Language and is a standard language used for managing and manipulating relational databases. Abbreviating it would not be appropriate as it would lead to confusion and potential errors in writing and understanding SQL statements.
25.
SQL Is Manipulates data and table definitions in the data base
Correct Answer
A. True
Explanation
SQL (Structured Query Language) is a programming language used for managing and manipulating relational databases. It allows users to perform various operations on data, such as inserting, updating, and deleting records, as well as querying and retrieving data from tables. Additionally, SQL can be used to define and modify the structure of database tables, including creating, altering, and dropping tables. Therefore, the statement "SQL manipulates data and table definitions in the database" is true.