Yangi table yaratish


Download 16.79 Kb.
Sana13.04.2023
Hajmi16.79 Kb.
#1349585
Bog'liq
Malumotlar bazasi (2)


Yangi TABLE yaratish:
CREATE TABLE foydalanuvchilar(id int PRIMARY KEY, full_name varchar(30), address varchar(30), phone_number int, all_price int)
CREATE TABLE oshpazlar(id int PRIMARY KEY, full_name varchar(30), phone_number int, staj int)
CREATE TABLE pitsalar(id int PRIMARY KEY, name varchar(30), description text, price int)
CREATE TABLE yetkazib_beruvchi(id int PRIMARY KEY, full_name varchar(30), phone_number int, car_number varchar(30))

TABLEga malumot qoshish
INSERT INTO `foydalanuvchilar`(`id`, `full_name`, `address`, `phone_number`, `all_price`) VALUES (2,'Sobirov Jamshid1','Urganch Park yoni', 998938671212, 125000)
INSERT INTO `oshpazlar`(`id`, `full_name`, `phone_number`, `staj`) VALUES (1,'Saidova Saida', 9301231212, 2)
INSERT INTO `pitsalar`(`id`, `name`, `description`, `price`) VALUES (1,'Belissimo pizza', 'Juda ajoyib bolgan Belissimo pizza', 55000)
INSERT INTO `yetkazib_beruvchi`(`id`, `full_name`, `phone_number`, `car_number`) VALUES (1,'Tokhirov Xoltoy', 914561232, '90U479OA')

TABLEdan malumotni DELETE:
DELETE FROM `foydalanuvchilar` WHERE id = 2
DELETE FROM `oshpazlar` WHERE id = 1
DELETE FROM `pitsalar` WHERE id = 1
DELETE FROM `yetkazib_beruvchi` WHERE id = 1

TABLEdan malumotni UPDATE qilish:
UPDATE `foydalanuvchilar` SET `address`='TATU UF binosi' WHERE id = 1
UPDATE `oshpazlar ` SET `phone_number`= 936966337 WHERE id = 1
UPDATE `pitsalar` SET `description`='Masalliqlar haqida',`price`=60000 WHERE id = 1
UPDATE `yetkazib_beruvchi` SET `full_name`='Qodirov Qaxromon', `phone_number`=901234567, `car_number`='90P888AA' WHERE id = 1

TABLEdan malumotni SELECT qilib olish:
SELECT * FROM `foydalanuvchilar` WHERE 1;
SELECT * FROM `oshpazlar` WHERE id > 3 and id <= 5;
SELECT price FROM `pitsalar` WHERE id>2 or id<=15;
SELECT phone_number, car_number FROM `yetkazib_beruvchi` WHERE 1;
Download 16.79 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling