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

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 (59.7k points)
edited by | 2.8k views

1 Answer

+29 votes
Best answer

(D)

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
0
It say no indexes are present on relation I think !
0
Someone explain Option B
+1
sql query will definitely work even without creating any indexes on any columns. Only it might be slow.
+16
ANS (D)

A. Sql doesn't eliminate duplicate rows like relational algebra.to 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.
+1

Answer will be C.

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

Refer :https://en.wikipedia.org/wiki/Relational_model 

Under this heading 

  • SQL and the relational model
  1. Duplicate column names
0
@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
https://gateoverflow.in/3718/gate2004-it-74 both contradict , verify pls
0
@Anu007

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...

@sid1221

what contradiction u r facing??
0
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.
0

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):-  https://dev.mysql.com/doc/refman/8.0/en/mysql-indexes.html 

Answer:

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

44,253 questions
49,750 answers
164,098 comments
65,845 users