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.
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.
the right answer is line 4, you cannot specify a precision for int.
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
Which of the above-mentioned lines has an error?
Which LINES? Correct answers: Line 2 AND Line 4.
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)