https://paiza.io/projects/bvUkw5Q5eXW8x6GLNCef9A?language=mysql
MY SQL: USE THE BELOW EXAMPLE & CODES:
WITHOUT DATE:
CREATE DATABASE SCHOOL;
USE SCHOOL;
CREATE TABLE STUDENT
(ROLLNO INT PRIMARY KEY,
STUDENTNAME VARCHAR(20) NOT NULL,
TOTALMARKS INT,
GRADE CHAR(2)
);
DESC STUDENT;
INSERT INTO STUDENT VALUES (1, 'NOMON SINGHA', '550', 'A1');
INSERT INTO STUDENT VALUES (2, 'PANKAJ CHAUHAN', '580',
'A1');
INSERT INTO STUDENT VALUES (3, 'SUDIP DAS', '450', 'B1');
INSERT INTO STUDENT VALUES (4, 'SUMON AGARWALA', '360',
NULL);
INSERT INTO STUDENT VALUES (5, 'BABAMA', '590','A');
SELECT * FROM STUDENT
WITH DATE:
CREATE DATABASE SCHOOL;
USE SCHOOL;
CREATE TABLE STUDENT
(ROLLNO INT PRIMARY KEY,
STUDENTNAME VARCHAR(20)
NOT NULL,
TOTALMARKS INT,
GRADE CHAR(2),
DateOfResult date
);
DESC STUDENT;
INSERT INTO STUDENT
VALUES (1, 'NOMON SINGHA', '550', 'A1', '2021-03-01');
INSERT INTO STUDENT
VALUES (2, 'PANKAJ CHAUHAN', '580', 'A1', '2021-02-28');
INSERT INTO STUDENT
VALUES (3, 'SUDIP DAS', '450', 'B1', '2021-01-01');
INSERT INTO STUDENT
VALUES (4, 'SUMON AGARWALA', '360', NULL, NULL);
INSERT INTO STUDENT
VALUES (5, 'BABAMA', '590','A', '2021-03-03');
SELECT * FROM STUDENT
Ex- CREATE A TABLE ‘CUSTOMER’ IN A DATABASE NAMED ‘ARUN’
WITH THE FIELDS GIVEN ALONGSIDE THEN DISPLAY THE STRUCTURE OF THE TABLE INSERT
FIVE RECORDS AND DISPLAY ITS CONTENTS.
Column Name |
Data Type |
Size |
Constraints |
CustID |
INT |
|
PRIMARY KEY |
CustName |
VARCHAR |
20 |
NOT NULL |
CustMobile |
VARCHAR |
11 |
NOT NULL |
CardCategory |
CHAR |
1 |
It is either A, B, or C |
Answer:
CREATE DATABASE ARUN;
USE ARUN;
CREATE TABLE CUSTOMER
(CUSID INT PRIMARY KEY,
CUSTNAME VARCHAR(20) NOT NULL,
CUSTMOBILE VARCHAR(11) NOT NULL,
CARDCATEGORY CHAR
);
DESC CUSTOMER;
INSERT INTO CUSTOMER VALUES (1, 'MANISH', '9899-453943', 'A');
INSERT INTO CUSTOMER VALUES (2, 'VIKAS', '9999-487643', 'B');
INSERT INTO CUSTOMER VALUES (3, 'DIBYA', '9788-887663', 'B');
INSERT INTO CUSTOMER VALUES (4, 'YOGESH', '8899-455322', 'A');
INSERT INTO CUSTOMER VALUES (5, 'PRANSHU', '8799-997762', 'C');
SELECT * FROM CUSTOMER