English

Create the other two relations GUARDIAN and ATTENDANCE as per data types given in Table, and view their structures. Don't add any constraint in the two tables.

Advertisements
Advertisements

Question

Create the other two relations GUARDIAN and ATTENDANCE as per data types given in Table, and view their structures. Don't add any constraint in the two tables.

Attribute Name Data expected to be stored Data type Constraint
GUID Numeric value consisting of 12 digit Aadhaar number CHAR(12) PRIMARY KEY
GName Variant length string of maximum 20 characters VARCHAR(20) NOT NULL
GPhone Numeric value consisting of 10 digit CHAR(10) NULL UNIQUE
GAddress Variant length string of size 30 characters VARCHAR(30) NOT NULL

 

Attribute Name Data expected to be stored Data type Constraint
AttendanceDate Date value DATE PRIMARY KEY*
RollNumber Numeric value consisting of maximum 3 digits INT PRIMARY KEY* FOREIGN KEY
AttendanceStatus ‘P’ for present and ‘A’ for absent CHAR(1) NOT NULL
Code Writing
Advertisements

Solution

CREATE TABLE GUARDIAN (
    GUID CHAR(12),
    GName VARCHAR(20),
    GPhone CHAR(10),
    GAddress VARCHAR(30)
);
CREATE TABLE ATTENDANCE (
    AttendanceDate DATE,
    RollNumber INT,
    AttendanceStatus CHAR(1)
);

DESC GUARDIAN;

DESC ATTENDANCE;

GUARDIAN

ield Type
GUID CHAR(12)
GName VARCHAR(20)
GPhone CHAR(10)
GAddress VARCHAR(30)

ATTENDANCE

Field Type
AttendanceDate DATE
RollNumber INT
AttendanceStatus CHAR(1)
shaalaa.com
  Is there an error in this question or solution?
Chapter 8: Introduction to Structured Query Language (SQL) - Intext Questions [Page 148]

APPEARS IN

NCERT Informatics Practices [English] Class 11
Chapter 8 Introduction to Structured Query Language (SQL)
Intext Questions | Q 7. | Page 148
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×