create a table file, having columns file no.(fno, integer,unique), category(cat, variable size character 12, cannot be empty), date of creation(doc,date) and owner of file(owner, variable character 20)
create table file
(
fno smallint primary key,
cat varchar(12) not null,
doc date,
owner varchar(20)
);
To change the age(age) and name(ename) of employee number(empno) 1 to 12 and XYZ in emp table
Update EMP
Set age=12 , ename=’XYZ’
Where empno=1;
to add a column sal decimal(7,2) which is positive in emp
Alter table emp
add sal decimal(7,2) unsigned ;
To make empno as primary key in table emp
Alter table emp
Add primary key(Empno);
to change the size of (ename, varchar) to 30 in emp table
Alter table emp
Modify ename varchar(30) ;
Give syntax for left function
select left(STRING, No. of Charcaters from left);
Given syntax for mid
select mid(STRING,pos,No. of Charcaters);
give function to retrieve day from a date
select day('YYYY-MM-DD');
give function to display name of the day from a given date
select dayname('YYYY-MM-DD');
which function converts negative no. to positive no.?
ABS
give function to display the system date and time
now()
give output for the following
mod(89,7)
5
give output for the following
round(934.45,-1)
930
give outputs for the following
select mod(87,-5)
select mod(-87,5)
select mod(-87,-5)
2
-2
-2
give output for the following
select mid('The quick brown fox jumps over the lazy dog ', 7, 11);
ick brown f
delete a column enm from emp
alter table emp
drop enm;
give structure of table emp
desc emp;
give a query to select all the rows from the table emp
select * from emp;
increase the sal of all employees by 7000 where city is MUM in emp table
update emp
set sal=sal+7000
where city='MUM';
insert a record in table emp having following columns
eid smallint primary key auto_increment
enm varchar(15) not null
deptid char(3)
dob date
sal decimal(8,2)
insert into emp(enm,deptid,dob,sal) values('abc','xyz','1999-09-06',56000);
create a database TYBCOM_777
create database tybcom_777;
delete table emp
drop table emp;
change the auto_increment sequence from 501 for emp table
alter table emp
auto_increment=501;
which function is used to append or merge to different string?
concat
output of :
select now('2000-09-11 23:54:43')+0;
20220713220843.000000