SQL Apprentice Question
I have a table named myTable. It is sorted by some column and there is
no primery key or unique column.I want to retrieve all records from
30th record to 50th record. How can I do this by a sql statement?
Celko Answers
>> I have a table named myTable. It is sorted by some column and there is no primary key or unique column. <<
BY DEFINITION:
1) Tables have at least one key
2) Tables have no ordering
>> I want to retrieve all records from 30th record to 50th record. <<
1) Rows are not anything like records
2) Tables have no ordering
Please read a book --ANY book -- are RDBMS. You have gotten every
basic concept wrong.
Original Source
Showing posts with label Database Design. Show all posts
Showing posts with label Database Design. Show all posts
Thursday, October 04, 2007
Tuesday, June 12, 2007
Database Design Question
SQL Apprentice Question
I'm fairly new to database design, having only really worked with
existing tables etc in the past.
Simple question this really...........
In a users table, is it wise to have a ManagerID column that is
effectively pointing to another user in the same table, with the
theory being that if that person is top dog, they will just have a
null entry in ManagerID.
I will check for circular references before entering the data.
Is there a better way of storing the data, or is this the only way?
Celko Answers
>> Is there a better way of storing the data, or is this the only way? <<
Get a copy of TREES & HIERARCHIES IN SQL for several different ways to
do an organizational chart. What you have is thd adjacency list
model; look up the nested sets model.
Original Source
I'm fairly new to database design, having only really worked with
existing tables etc in the past.
Simple question this really...........
In a users table, is it wise to have a ManagerID column that is
effectively pointing to another user in the same table, with the
theory being that if that person is top dog, they will just have a
null entry in ManagerID.
I will check for circular references before entering the data.
Is there a better way of storing the data, or is this the only way?
Celko Answers
>> Is there a better way of storing the data, or is this the only way? <<
Get a copy of TREES & HIERARCHIES IN SQL for several different ways to
do an organizational chart. What you have is thd adjacency list
model; look up the nested sets model.
Original Source
Subscribe to:
Posts (Atom)