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

Mysql

Uploaded by

Dhruti Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Mysql

Uploaded by

Dhruti Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Q1.

Use db1;
Create table Emp(
Empid int Primary key,
Ename varchar(20) not null,
Salary int,
Comm int);
alter table Emp add column designation varchar(20);
alter table Emp modify Salary int (5);
alter table Emp drop column Comm ;
desc Emp;

Q2. create database PROJECT;


use PROJECT;
create table Book(
No int,
Title varchar(30),
Author varchar(15),
Type char(10),
Pub varchar(15),
Qty int,
Price int);
insert into Book values(1,’Data Structure’,’Lipschutz’,’DS’,’McGraw’,3,200),
(2,’Computer Studies’,’French’,’FND’,’Galgotia’,2,75),
(3,’Advanced Pascal’,’ Schildt’,’PROG’,’McGraw’,4,350),
(4,’Dbase dummies’,’ Palmer’,’DBMS’,’PustakM’,5,130),
(5,’Mastering C++’,’Gurewich’,’PROG’,’BPB’,3,295),
(6,’Guide Network’,’Freed’,’NET’,’ZPress’,3,200),
(7,’Mastering Foxpro’,’Seigal’,’DBMS’,’BPB’,2,135);
select Title, Price from Book;
select Title, Author, Price from Book;
select Title “Book Name”,Price “Price of the book” from Book;
SELECT Price*100 ‘Price increased by 100’ from Book;
select DISTINCT (Type) from Book;
select * from Book where Author=’French’;
select * from Book where Title=’Mastering Foxpro’;
select Title from Book where Price<200;
select * from Book where Qty>3;
select Title from Book where Qty >3 and Price >200;
select concat(Ucase(type),pub) “show” from book where price>200;
select Substr(title,2,5) from book;
select instr(“Swaminarayan”,”min”);
select length(title)+price from book where price=200;
select mod(qty,2) from book;
select round(234.345,2),truncate(2345.234,1);
select year(curdate)+dayofweek(curdate) “date” ;
select count(Title) from Book GROUP BY Pub;
Select max(Price) from Book where Type=’PROG’;
Select max(Price), Pub from Book where Price>150;

You might also like