Question:
Bunch of SQL Questions...?
2011-05-06 11:02:28 UTC
Question1:
A company Has following Departments:
Marketing, Designing,Production, packing

What will be the result of following query?

select * from table where department < 'Marketing';

Options are:
1) Query will return "Designing , packing"
2) Query will return "Designing ,Production, packing"
3) Query will return "packing"
4) String cannot be compared using < operator
5)Query will return "Designing";

Question 2:
Examine the two statements given below:

SELECT last_name, salary,hire_date FROM EMPLOYEES ORDER BY salary DESC
SELECT last_name, salary,hire_date FROM EMPLOYEES ORDER BY 2 DESC

What is true about them?

1) Two statements produce identical results
2)Second statement returns an error
3) There is no need to specify DESC because the results are stored in descending order by default.

Question 3:

How many foreign keys one can have in table?
options: 1, 2, 3, 4, 5, 6, None of above

Question 4:
Where should be SubQueries be used?

Options are:
1) To define the set of rows to be inserted in table
2) To define the set of rows to be included in a view
3) To define one or more values to be assigned to existing rows.
4) To provide values for condition in where clause
5) To define a table to be operated on by containing query
6) All of the above are correct.
7)None of the above is correct.

Question 5:

Which of the following statement are incorrect regarding simple & complex view?

options are:

1) A compex view is a combination of more than one single view.
2) A table can either have simple or complex view not both

Question 6:

Are both the statements correct:

Where deptNo in(2,4,5)
where deptNo =2 or deptNo=4 or deptNo=5

options are
a) true
b)False
Three answers:
Mike S
2011-05-06 11:58:15 UTC
1. 5 just designing. strings are compared alphabetically

2. 1 - identical results, sorting on the same column (salary that has position of 2 in recordet)

3. none of above - there is no predefined limit on foreign keys

4. should be all of the above

5. 2 is incorrect

6. a - true, both producte equivalent result
2011-05-06 18:37:59 UTC
Question 1:

The String cannot be compared using < operator.



The <,> operators are only for integers.



Question 2:

Second statement returns an error.

"SELECT last_name, salary,hire_date FROM EMPLOYEES ORDER BY salary DESC" is tue.



ORDER BY can only be used with table names not integers.



Question 3:

I am not sure but I think it is none od the above.

This also depends on the type of database you're using.



Question 4:

To define one or more values to be assigned to existing rows. I think.

I am not sure what is meant by SubQueries.



Question 5:

A table can either have simple or complex view.



Question 6:

False.

Statement 2 is correct.
TheMadProfessor
2011-05-06 19:17:57 UTC
1) Depends on the collating sequence defined for the DBMS but most likely 1 (if lower case defined 'less than' upper case) or 5 (if not)



2) 1



3) None of the above...there's no (practical) limit I'm aware of



4) 6



5) Not certain towards 1 but pretty sure 2 is incorrect



6) Other than possible whitespace issues, I'd say they're both correct


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...