Author Question: Explain the MySQL cursor statements. What will be an ideal ... (Read 21 times)

codyclark

  • Hero Member
  • *****
  • Posts: 538
Explain the MySQL cursor statements.
 
  What will be an ideal response?

Question 2

What is the multivalue, multicolumn problem, and why is it a problem? Include an example.
 
  What will be an ideal response?



aburgess

  • Sr. Member
  • ****
  • Posts: 361
Answer to Question 1

The MySQL cursor statements include DECLARE CURSOR CursorName to define a cursor, OPEN CursorName to actually start the use of the cursor, and CLOSE CursorName to end the use of a cursor. While the cursor is running, the FETCH keyword is used to retrieve row data. A cursor is used with a looping structure of some sort, which can be created using the REPEAT and WHILE keywords.

Answer to Question 2

The multivalue, multicolumn problem occurs when a table uses multiple columns to store multiple values of an attribute. For example, a database of dog owners might have a table with the structure:

DOG_OWNER (OwnerID, LastName, FirstName, DogName01, DogName02, DogName03 )

This is a problem because (1 ) the number of DogNames is fixed, and (2 ) this structure creates query problems. In fact, this structure is another form of the multivalued dependency, and requires a similar solution: a DOG table should be created to store the DogNames and with a foreign key to link the dogs to their owner.



Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
 

Did you know?

Your chance of developing a kidney stone is 1 in 10. In recent years, approximately 3.7 million people in the United States were diagnosed with a kidney disease.

Did you know?

More than 150,000 Americans killed by cardiovascular disease are younger than the age of 65 years.

Did you know?

The types of cancer that alpha interferons are used to treat include hairy cell leukemia, melanoma, follicular non-Hodgkin's lymphoma, and AIDS-related Kaposi's sarcoma.

Did you know?

A seasonal flu vaccine is the best way to reduce the chances you will get seasonal influenza and spread it to others.

Did you know?

The human body's pharmacokinetics are quite varied. Our hair holds onto drugs longer than our urine, blood, or saliva. For example, alcohol can be detected in the hair for up to 90 days after it was consumed. The same is true for marijuana, cocaine, ecstasy, heroin, methamphetamine, and nicotine.

For a complete list of videos, visit our video library