If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Pleeease...What is the cursor, index, and cluster?with an example

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-04, 05:19
Mr_Shihab Mr_Shihab is offline
Registered User
 
Join Date: Apr 2004
Posts: 13
Smile Pleeease...What is the cursor, index, and cluster?with an example

I studied computer sience in the university?
In my study we practice some SQL statements with Oracle, and SQL Server
Also, We studied some database concepts like
But, until now I haven't clear opinion about CLUSTERS, INDEXES, and CURSORS in the database?

Please give an overview about them with small examples to clarify

Thank you very much
Reply With Quote
  #2 (permalink)  
Old 04-27-04, 15:24
john11 john11 is offline
Registered User
 
Join Date: Jan 2003
Posts: 6
a LITTLE help

While I await some help of my own, I can tell you this:

You should look at an index as separate file. This file contains some of the values from the table to which the index is associated. The index file is sorted to meet a specific requirement.

Example: You have an Invoices table and an Invoice_Line_Items table. Invoices of course contains information specific to the Invoice itself i.e. Invoice Date, Customer Number, etc.

Invoice Line Items are the items included on the Invoice. You probably already know all that.

Let's say Invoice_Line_Items has 4 fields: The Invoice_Number (to which this set of Invoice_Line_Ites is related, Line_Number (assume that as items are added to an invoice, the new line item is assigned the next Line_Number), and Product_Number (the product being sold) and Quantity_Sold.

Now let's say you need to print or display the Invoice and it's line items. You probably want the Line Items to be printed or displayed in the same order as they were created. You would build an index on Invoice_Number + Line_Number from your Invoice_Line_Items table.

DBMS's use indexes to read thru the data in a table. The programmer would dictate which index to use (the one I defined) when needing to print or display an Invoice and it's related Line Items.

As for Cursors, my definition is a temporary table. Some call this a view or at least use the terms interchangably. It is some subset of the data from one or more tables, pulled together in a temporary table.

In the indexing example above, in order to display or print an invoice you will need some data from the Invoices table and the related data from the Invoice_Line_Items table. I would create a view (I am assuming a view and cursor are the same thing), pulling the data I need from Invoices and the data I need from Invoice_Line_Items into a cursor/view named Invoice_Data.

As for clusters, never heard that term.

Hope this helps,
John
Reply With Quote
  #3 (permalink)  
Old 04-28-04, 00:09
Mr_Shihab Mr_Shihab is offline
Registered User
 
Join Date: Apr 2004
Posts: 13
Smile Thank you for your reply

Thank you very much for your reply
Reply With Quote
  #4 (permalink)  
Old 05-03-04, 17:04
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
The following relates to Microsoft SQL Server databases:

An Index orders data for faster sorting and searching. A table may have one CLUSTERED index, and the records in the table are stored in the physical order determined by this index. A table may have one or more non-clustered indexes. These are separate objects that store the indexed values along with pointers to the original data.

A CURSOR is neither a temporary table or a view. It is a method of stepping through a dataset (such as a table or view) and operating on a single record at a time. Because it is not a set-based transaction, it is almost never an efficient method of reading or editing data.

Please note that CLUSTER can also refer to a group of database servers operating together for failover security.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On