MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Create the Shopper table with appropriate data types for the attributes described below. Column Name Constraints DESCRIPTION Shopperid PRIMARY KEY Unique id of the shopper. For ex. 2001, 2003 ShopperName NOT NULL Name of the Shopper. It cannot be more than 20 characters. Gender should be only ‘Male’ or ‘Female’ Gender of the Shopper. It cannot be more than 6 characters. MobileNo NOT NULL Mobile number of the Shopper in numeric form. Characters like brackets and hyphens are not allowed. Address Address of the Shopper. It cannot be more than 50 characters. For ex. Allen Street, New York
A
create table shopper(shopperid number(4) primary key, shopperName varchar(20) not null, gender varchar(6), Mobileno number not null, Address varchar(50), GENDER in (’Male’, ‘Female’));
B
create table shopper(shopperid number(4) primary key, shopperName varchar(20) not null, gender varchar(10), Mobileno number not null, Address varchar(50), check(GENDER in (’Male’, ‘Female’)));
C
create table shopper(shopperid number(4) primary key, shopperName varchar(25) not null, gender varchar(10), Mobileno number not null, Address varchar(50), check(GENDER in (’Male’, ‘Female’)));
D
create table shopper(shopperid number(4) primary key, shopperName varchar(20) not null, gender varchar(6), Mobileno number not null, Address varchar(50), CONSTRAINT CHK ____ Gender check(GENDER in (’Male’, ‘Female’)));
Explanation: 

Detailed explanation-1: -Create the Shopper table with appropriate data types for the attributes described below. create table shopper(shopperid integer primary key, shoppername varchar2(20) not null, gender varchar2(6) check (gender in (’Male’, ‘Female’)), mobileno number(10) not null, address varchar2(50));

Detailed explanation-2: -Use the view table constraints in the information schema schema. The column table name gives you the name of the table in which the constraint is defined, and the column constraint name contains the name of the constraint.

Detailed explanation-3: -The CREATE TABLE statement defines a table. The definition must include its name and the names and attributes of its columns. The definition can include other attributes of the table, such as its primary key or check constraints. To create a created temporary table, use the CREATE GLOBAL TEMPORARY TABLE statement.

There is 1 question to complete.