1.
Which SQL command is used to extract data from tables?
Correct Answer
B. SELECT
Explanation
The SELECT command is used in SQL to extract data from tables. It allows you to specify the columns you want to retrieve and apply filters or conditions to narrow down the results. This command is fundamental in retrieving specific data from a database and is widely used in querying and analyzing data. The other options, EXTRACT and FIND, are not SQL commands used for extracting data from tables.
2.
Which SQL keyword is used to sort the result set?
Correct Answer
C. ORDER BY
Explanation
The SQL keyword used to sort the result set is "ORDER BY". This keyword is followed by the column or columns that you want to sort the result set by. It arranges the rows in ascending or descending order based on the specified column(s).
3.
The AND operator displays a record if ANY of the conditions listed are true.
Correct Answer
B. False
Explanation
The AND operator displays a record if ALL of the conditions listed are true, not just any of them.
4.
Stored procedures can be execute on remote Adaptive Servers.
Correct Answer
A. YES
Explanation
Stored procedures can be executed on remote Adaptive Servers. This means that a stored procedure, which is a set of pre-compiled SQL statements, can be run on a different server from where it is stored. This allows for greater flexibility and scalability in managing and executing database operations. By enabling the execution of stored procedures on remote servers, organizations can distribute their workload and resources more effectively, improving overall performance and efficiency.
5.
In Create stored procedure, the Parameter names can be a maximum of 30 bytes long, including the @ sign.
Correct Answer
A. True
Explanation
In the context of creating a stored procedure, the parameter names can have a maximum length of 30 bytes, which includes the "@" sign. This means that the names assigned to the parameters within the stored procedure cannot exceed this limit. Therefore, the statement is true.
6.
Which of the following command will be used for execute a Stored procedure?
A) exec procedure_name
B) execute procedure_name
C) procedure_name
Correct Answer
D. All A, B and C
Explanation
The correct answer is All A, B and C. This is because all three options (A, B, and C) can be used to execute a stored procedure. The "exec" and "execute" keywords are both valid ways to execute a stored procedure in SQL, and in some cases, the procedure name can be executed directly without using any keyword. Therefore, all three options are correct.
7.
Count(*) returns the total number of non-NULL values in the column.
Correct Answer
B. False
Explanation
The statement is false because count(*) actually returns the total number of rows in a table, regardless of whether the values in the column are NULL or not. If you want to count only the non-NULL values in a column, you should use count(column_name) instead.
8.
Assume that today's is monday and today's date is 11 apr 2011.
Result of the following query:
select datename(dw,getdate())
Correct Answer
C. Monday
Explanation
The query "select datename(dw,getdate())" is asking for the name of the day of the week for the current date. Since today is Monday, the result of the query is "monday".
9.
Assume that today's is monday and today's date is 11 apr 2011.
Result of the following query:
select datepart(dw,getdate())
Correct Answer
D. 2
Explanation
The query "select datepart(dw,getdate())" is used to retrieve the day of the week for the current date. In this case, the current date is April 11, 2011, which falls on a Monday. The datepart(dw) function returns the day of the week as a number, where Sunday is represented by 1 and Saturday is represented by 7. Therefore, the result of the query is 2, indicating that it is Monday.
10.
We can define primary key and foreign key on views.
Correct Answer
A. True
Explanation
Primary keys and foreign keys can be defined on tables to establish relationships between them. However, it is not possible to define primary keys and foreign keys directly on views. Views are virtual tables that are generated based on the underlying tables and do not have their own physical storage. Therefore, primary keys and foreign keys can only be defined on the actual tables, not on views.