ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل Hasan Habib , Digital Transformation Specialist , Tritech
تاريخ النشر: 2013/10/26
Jad Al-Quraan
من قبل 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
من قبل 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

مستخدم محذوف‎
من قبل مستخدم محذوف‎

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
من قبل 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.

المزيد من الأسئلة المماثلة