0% found this document useful (0 votes)
10 views

Dbms Assign1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Dbms Assign1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

NAME: Dnyaneshwari Malve

CLASS: TY AIA1
BATCH: A
ROLL NO.: 2213020
ENROLLMENT NO.: MITU21BTCS0202
SUBJECT: DBMS Lab

Assignment 1

1)mysql> create table Category(CategoryID Char(3),Category


Char(20),Description Varchar(100));
Query OK, 0 rows affected (0.03 sec)

2)mysql> create table Toybrand(BrandID Char(3),BrandName Varchar(20));


Query OK, 0 rows affected (3.30 sec)

3)mysql> create table Toys(ToyID Char(6),ToyName Varchar(10),ToyDesc


Varchar(25),CategoryID Char(3),ToyRate Numeric(5,2),BrandID Char(3),ToyQoh
Numeric(5),LowerAge Numeric(3),UpperAge Numeric(3),Toyweight
Numeric(6));
Query OK, 0 rows affected (0.02 sec)

4.a)mysql> alter table Category add Constraint primary key(CategoryID);


Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0

4.b)mysql> alter table Category add Constraint unique(Category);


Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0

4.c)mysql> alter table Category modify Description Varchar(100) null;


Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0

5.a)mysql> alter table Toybrand add Constraint primary key(BrandID);


Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0

5.b)mysql> alter table Toybrand add Constraint unique(BrandName);


Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0

6.a)mysql> alter table Toys add Constraint primary key(ToyID);


Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0

6.b)mysql> alter table Toys add Constraint check(ToyQoh>0 and ToyQoh<200);


Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0

6.c.1)mysql> alter table Toys modify Toydesc Varchar(25) not null;


Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
6.c.2)mysql> alter table Toys modify ToyName Varchar(10) not null;
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0

6.d)mysql> alter table Toys alter LowerAge set default 1;


Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0

6.e)mysql> alter table Toys add foreign key(CategoryID) REFERENCES


Category(CategoryID);
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0

7.a)mysql> alter table Toys alter UpperAge set default 1;


Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0

7.b)mysql> alter table Toys add Constraint check(ToyRate>0);


Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0

7.c)mysql> alter table Toys alter Toyweight set default 1;


Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0

You might also like