tugas fungsi string . . . . . . . . .
create database lat_0032;
use lat_0032;
create table dataku (no_id varchar(15) primary key,nama varchar(25),alamat varchar(20),gaji int,tgl_lhr date,sex char(1));
desc dataku;
insert into dataku values('223344550','Andhika Pratama','Semarang',2500000,'1987-06-26','L');
insert into dataku values('223344551','Susi Febrianti','Semarang',2000000,'1986-02-14','W'),
('223344552','Novi Heriza','Yogyakarta',2000000,'1989-05-31','W'),
('223344553','Raditya Surya','Bandung',1500000,'1988-12-30','L'),
('223344554','Angela Suryani','Surabaya',3000000,'1987-07-21','W'),
('223344555','Putri Setyowati','Medan',3500000,'1985-07-23','W'),
('223344556','Abdul Munir','Magelang',850000,'1990-06-05','L'),
('223344557','Heri Setyawan','Surabaya',900000,'1989-08-17','L'),
('223344558','Setyorini','Yogyakarta',1200000,'1987-03-15','W'),
('223344559','Sofia Anggun','Bandung',900000,'1986-01-03','W');
select*from dataku;
select nama from dataku
where char_length(nama) <15
order by nama;
select dataku.nama, format(dataku.gaji,0)
from dataku;
select nama from dataku
where mid(nama,2,1) = 'n';
select left(nama,5)
from dataku;
select right(nama,5)
from dataku;
select replace(nama,'e','c')
from dataku;
select ucase(nama)
from dataku;
select dataku.nama,
lpad(format(dataku.gaji,0),12,char(32))
from dataku where dataku.no_id;
end tags . . .
create database lat_0032;
use lat_0032;
create table dataku (no_id varchar(15) primary key,nama varchar(25),alamat varchar(20),gaji int,tgl_lhr date,sex char(1));
desc dataku;
insert into dataku values('223344550','Andhika Pratama','Semarang',2500000,'1987-06-26','L');
insert into dataku values('223344551','Susi Febrianti','Semarang',2000000,'1986-02-14','W'),
('223344552','Novi Heriza','Yogyakarta',2000000,'1989-05-31','W'),
('223344553','Raditya Surya','Bandung',1500000,'1988-12-30','L'),
('223344554','Angela Suryani','Surabaya',3000000,'1987-07-21','W'),
('223344555','Putri Setyowati','Medan',3500000,'1985-07-23','W'),
('223344556','Abdul Munir','Magelang',850000,'1990-06-05','L'),
('223344557','Heri Setyawan','Surabaya',900000,'1989-08-17','L'),
('223344558','Setyorini','Yogyakarta',1200000,'1987-03-15','W'),
('223344559','Sofia Anggun','Bandung',900000,'1986-01-03','W');
select*from dataku;
select nama from dataku
where char_length(nama) <15
order by nama;
select dataku.nama, format(dataku.gaji,0)
from dataku;
select nama from dataku
where mid(nama,2,1) = 'n';
select left(nama,5)
from dataku;
select right(nama,5)
from dataku;
select replace(nama,'e','c')
from dataku;
select ucase(nama)
from dataku;
select dataku.nama,
lpad(format(dataku.gaji,0),12,char(32))
from dataku where dataku.no_id;
end tags . . .
No comments:
Post a Comment
Your comments are very valuable