MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Create the Article table as per specification below. Column Name Data Type Constraints DESCRIPTION ArCode CHAR(5) PRIMARY KEY; Must begin with character ‘A’ Unique code of the article e.g. A1001, A1004 ArName VARCHAR2(30) NOT NULL Article Name Rate NUMBER(8, 2) Rate of the article. For ex. 5000.0 Quantity NUMBER(4) Greater than or equal to 0; Default Value is 0 Quantity availability of the article. For ex. 20 Class CHAR(1) Can be A, B or C Class of the article
A
create table article(ArCode char(5) primary key, ArName varchar2(30) Not null, rate number(8, 2), Quantity number(4) default 0, class char(1), check(ArCode like ‘A%’), check (Quantity>=0), check(Class in(’A’, ‘B’, ))
B
create table article(ArCode char(5) primary key, ArName varchar2(30) Not null, rate number(8, 2), Quantity number(4) default 0, class char(1), check(ArCode like ‘A%’), check (Quantity>=0), check(Class in(’A’, ‘B’, ‘C’))
C
create table article(ArCode char(5) primary key, ArName varchar2(30) Not null, rate number(8, 2), Quantity number(4) default 0, class char(1), check(ArCode like ‘%A%’), check (Quantity>=0), check(Class in(’A’, ‘B’, ‘C’))
D
create table article(ArCode char(5) primary key, ArName varchar2(30) Not null, rate number(8, 2), Quantity number(4) default 0, class char(1), check(ArCode like ‘A’), check (Quantity>=0), check(Class in(’A’, ‘B’, ‘C’))
Explanation: 

Detailed explanation-1: -The CHECK constraint is used to limit the value range that can be placed in a column. If you define a CHECK constraint on a column it will allow only certain values for this column.

There is 1 question to complete.