Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Select * from Student order by studentID - Do we get relational result from this query?

user-image
Question added by Hasan Habib , Digital Transformation Specialist , Tritech
Date Posted: 2013/10/26
Jad Al-Quraan
by Jad Al-Quraan , Head of department : analysis and systems development & Oracle DBA , Tafila Technical University

Come relations between at least two tables

It could be a single table in the event of self join 

Yameen Mohammed Khan
by Yameen Mohammed Khan , IT Manager , Al Faisal Medical Center

This is a poor sql statement. What kind of relational result is expected here? It just returns the entire table contents sorted by StudentId

Deleted user
by Deleted user

The result will be a table.. Using the term relational here is pretty illogical brother. Coz result set cannot be relational as far as I know.

 

Hasan Habib
by Hasan Habib , Digital Transformation Specialist , Tritech

to solve this question we need to understand what is relation. SQL query based on relational model. Relational Model based on Set theory and Predicate logic. in Set there is no term "Sort", it means you can't sort a set. so relational model don't have any sort. in relational model relation express as table. so if we want to say a table is relational in sql means it is not sorted and also Set defination depend on distinct element in set. So in this given sentence it is not distint and we use order by clause so this is not a relational query. but if we write it like"Select distinct * from Student" then it become relational query and we get a relationl output.

There is a misconception about relational database, that relation between tables and primary key makes it relationl actually it's not. Because of Relational model it calls Relational database.so in this question it is not a poor sql, its is a perfect cursor but not relational query.

More Questions Like This