Author Question: Explain the MySQL cursor statements. What will be an ideal ... (Read 22 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 skin wrinkles if you stay in the bathtub a long time because the outermost layer of skin (which consists of dead keratin) swells when it absorbs water. It is tightly attached to the skin below it, so it compensates for the increased area by wrinkling. This happens to the hands and feet because they have the thickest layer of dead keratin cells.

Did you know?

Critical care patients are twice as likely to receive the wrong medication. Of these errors, 20% are life-threatening, and 42% require additional life-sustaining treatments.

Did you know?

According to the National Institute of Environmental Health Sciences, lung disease is the third leading killer in the United States, responsible for one in seven deaths. It is the leading cause of death among infants under the age of one year.

Did you know?

Once thought to have neurofibromatosis, Joseph Merrick (also known as "the elephant man") is now, in retrospect, thought by clinical experts to have had Proteus syndrome. This endocrine disease causes continued and abnormal growth of the bones, muscles, skin, and so on and can become completely debilitating with severe deformities occurring anywhere on the body.

Did you know?

An identified risk factor for osteoporosis is the intake of excessive amounts of vitamin A. Dietary intake of approximately double the recommended daily amount of vitamin A, by women, has been shown to reduce bone mineral density and increase the chances for hip fractures compared with women who consumed the recommended daily amount (or less) of vitamin A.

For a complete list of videos, visit our video library