The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+24 votes

Which of the following is/are correct?

  1. An SQL query automatically eliminates duplicates
  2. An SQL query will not work if there are no indexes on the relations
  3. SQL permits attribute names to be repeated in the same relation
  4. None of the above
asked in Databases by Veteran (52k points)
edited by | 3.6k views

1 Answer

+30 votes
Best answer


SQL wont remove duplicates like relational algebra projection, we have to remove it explicitly by distinct.

If there are no indexes on the relation SQL will either chose one/more on its own or simply work without any index. No index would just slow the query but it will surely work.

SQL does not permit 2 attributes to have same name in a relation.

answered by Active (3.3k points)
edited by
It say no indexes are present on relation I think !
Someone explain Option B
sql query will definitely work even without creating any indexes on any columns. Only it might be slow.

A. Sql doesn't eliminate duplicate rows like relational eliminate duplicate row we need to use DISTINCT keyword with SELECT in SQL

B. Every table requires a primary key for performance. If you don’t have a primary key in any table, your tables don’t follow standard SQL requirements and performance suffers. Primary keys are automatically set as clustered indexes, which speeds up queries. They are always unique, so you can use an auto-incremented numeric value if you have no other column in the table that meets the unique requirement.

C. SQL not permits attributes names to be repeatedin the same relation

Therefore option D is correct.

Answer will be C.

Relational model does not permit but SQL is permit to have duplicate attribute name.

Refer : 

Under this heading 

  • SQL and the relational model
  1. Duplicate column names
@Anu007 it is mentioned in the wiki tht you provided is that only few database servers allow column to be same names,and it is very uncommon

It must be false because standard SQL servers don't allow column name to be same.
+1 both contradict , verify pls

Even if one DBMS is not allowing attributes names not to be repeated, u can not say that option C is true.

Only option D is correct...


what contradiction u r facing??
SQL queries will definitely work even there are no indexes bcz RDBMS add an attribute to every relation whose value is unique and not null. Yes performance will slow down.

Indexes are used to find rows with specific column values quickly. Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows.

More clarification for option(B):- 


Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,548 questions
54,174 answers
71,128 users