Guruh talabasi Abdig’opporov javoxir Mysql 1-2-amaliy ishlar


patientID INT UNSIGNED NOT NULL AUTO_INCREMENT



Download 353,77 Kb.
bet31/43
Sana18.07.2022
Hajmi353,77 Kb.
#818857
1   ...   27   28   29   30   31   32   33   34   ...   43
Bog'liq
311-18 AJ

patientID INT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(30) NOT NULL DEFAULT '',
dateOfBirth DATE NOT NULL,
lastVisitDate DATE NOT NULL,
nextVisitDate DATE NULL,
-- The 'Date' type contains a date value in 'yyyy-mm-dd'
PRIMARY KEY (patientID)
);
mysql> INSERT INTO patients VALUES
(1001, 'Ah Teck', '1991-12-31', '2012-01-20', NULL),
(NULL, 'Kumar', '2011-10-29', '2012-09-20', NULL),
(NULL, 'Ali', '2011-01-30', CURDATE(), NULL);
-- Date must be written as 'yyyy-mm-dd'
-- Function CURDATE() returns today's date
mysql> SELECT * FROM patients;
+-----------+---------+-------------+---------------+---------------+
| patientID | name | dateOfBirth | lastVisitDate | nextVisitDate |
+-----------+---------+-------------+---------------+---------------+
| 1001 | Ah Teck | 1991-12-31 | 2012-01-20 | NULL |
| 1002 | Kumar | 2011-10-29 | 2012-09-20 | NULL |
| 1003 | Ali | 2011-01-30 | 2012-10-21 | NULL |
+-----------+---------+-------------+---------------+---------------+

-- Select patients who last visited on a particular range of date


mysql> SELECT * FROM patients
WHERE lastVisitDate BETWEEN '2012-09-15' AND CURDATE()
ORDER BY lastVisitDate;
+-----------+-------+-------------+---------------+---------------+
| patientID | name | dateOfBirth | lastVisitDate | nextVisitDate |
+-----------+-------+-------------+---------------+---------------+
| 1002 | Kumar | 2011-10-29 | 2012-09-20 | NULL |
| 1003 | Ali | 2011-01-30 | 2012-10-21 | NULL |
+-----------+-------+-------------+---------------+---------------+
-- Select patients who were born in a particular year and sort by birth-month
-- Function YEAR(date), MONTH(date), DAY(date) returns
-- the year, month, day part of the given date
mysql> SELECT * FROM patients

Download 353,77 Kb.

Do'stlaringiz bilan baham:
1   ...   27   28   29   30   31   32   33   34   ...   43




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish