-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay6_Trick.sql
More file actions
41 lines (24 loc) · 1.16 KB
/
Day6_Trick.sql
File metadata and controls
41 lines (24 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-- CONCAT ----
create table customer (
musteri_no int,
ad VARCHAR(22),
soyad VARCHAR(25),
sehir varchar(45),
cinsiyet varchar(15),
puan int
);
INSERT INTO customer VALUES(111,'ebru', 'akar','denizli','kadin',78);
INSERT INTO customer VALUES(222,'ayse', 'kara','ankara','kadin',90);
INSERT INTO customer VALUES(333,'ali','gel','istanbul','erkek',66);
INSERT INTO customer VALUES(444, 'mehmet','okur','mus','erkek',98);
select concat(ad,' ',soyad) ad_soyad from customer;
select concat(musteri_no, '.) ',ad, ' ', soyad) musteri, sehir, cinsiyet, puan from customer;
-- ***************************************** length - left - right (String functions) *************************************
select * from customer;
select ad, length(ad), soyad, length(soyad) from customer;
select ad, left(ad, 1), soyad, left(soyad, 1) from customer;
select ad, soyad, concat(left(ad, 1), '.', left(soyad, 1)) Bas_Harf from customer;
-- soru: 5 ve 5 karakterden büyük olan isimleri MORRIS -> MRS şeklinde yazdırınız.
-- yani 1. , 3. ve 5. karakterleri alınız
select ad, concat(left(ad, 1), right(left(ad, 3), 1), right(left(ad, 5), 1)) kisaltma from customer
where length(ad)>5;