Which of the above-mentioned lines has an error?

Consider the case of a fruit juice company. The company manufactures fruit juices and supplies them to
wholesalers. The Database Designer creates a table named Production. The code is given below:
1.CREATE Table Production
2.(Fruit_type VarChar,
3.Fruit_name Char(20),
4.Quantity Int(3))
Which of the above-mentioned lines has an error?

Consider the case of a fruit juice company. The company manufactures fruit juices and supplies them to
wholesalers. The Database Designer creates a table named Production. The code is given below:
1.CREATE Table Production
2.(Fruit_type VarChar,
3.Fruit_name Char(20),
4.Quantity Int(3))
Which of the above-mentioned lines has an error?

A.
Line 3

B.
Line 2

C.
Line 1

D.
Line 4

Explanation:
In line 2, Fruit_type is declared as VarChar. A VarChar datatype should always specify the maximum length of
the column. However, in this case, the maximum length has not been specified.



Leave a Reply 5

Your email address will not be published. Required fields are marked *


Max

Max

It’s D. Paste in SSMS 2012 and line 4 has an error under Int(3). I don’t think you can specify a precision for an int, but you can leave off the max length for a varchar, and it defaults to a length of 1.

Francesca Mangano

Francesca Mangano

the right answer is line 4, you cannot specify a precision for int.

ajay

ajay

Consider the case of a fruit juice company. The company manufactures fruit juices and supplies
them to wholesalers. The Database Designer creates a table named Production. The code is given
below:
1. CREATE Table Production
2. 2.(Fruit_type VarChar,
3. Fruit_name Char(20),
4. Quantity Int(3))
Which of the above-mentioned lines has an error?
A. Line 3
B. Line 2
C. Line 1
D. Line 4
Correct Answer: B

Danny Boy

Danny Boy

Which of the above-mentioned lines has an error?

Which LINES? Correct answers: Line 2 AND Line 4.

Mickidy

Mickidy

Max is correct line 4 definitely is faulty but not specifying length of varchar is jus bad practice. If you did want a character length one youd jus use a char(1)