My SQL CURD
My SQL CURD
My SQL CURD
Roll No :- 52
+-------------+-----------------+------------+--------+-------------+
| doctor_name | specialization | phn_no | salary | consultant |
+-------------+-----------------+------------+--------+-------------+
| Dr.Onkar | Neurologist | 1234567895 | 200000 | Dr.Kulkarni |
| Dr.Ajinkya | Radiologist | 2222222 | 100000 | Dr.Pawar |
| Dr.Anurag | Radiologist | 33333333 | 80000 | Dr.Pawar |
| Dr.Durgesh | Cardiologist | 444444 | 90000 | Dr.Bhadane |
| Dr.Pravin | Cardiologist | 444444 | 50000 | Dr.Jain |
| Dr.Ram | Psychiatrist | 888888 | 70000 | Dr.shukla |
| Dr.Laxman | Radiologist | 66666 | 60000 | Dr.shukla |
| Dr.Sita | cardiologist | 444555 | 90000 | Dr.verma |
+-------------+-----------------+------------+--------+-------------+
8 rows in set (0.00 sec)
mysql> create table patient(pid int,pname varchar(20),DOB date,phn_no int(10),address
varchar(20),admit_date date,discharge_date date,doctor_name varchar(20),consultant
varchar(20),suffering_from varchar(20),ward varchar(20));
Query OK, 0 rows affected, 1 warning (1.65 sec)
mysql> select * from patient where admit_date between "2017-05-22" and "2018-07-30";
+------+-----------------+------------+--------+------------+------------+----------------+-------------+-----
-------+----------------+-------------+
| pid | pname | DOB | phn_no | address | admit_date | discharge_date | doctor_name | consultant |
suffering_from | ward |
+------+-----------------+------------+--------+------------+------------+----------------+-------------+-----
-------+----------------+-------------+
| 2 | Chris Ewans | 2000-01-11 | 33333 | Manchester | 2018-07-04 | 2018-07-22 | Dr.Pravin |
Dr.jain | Corona | SpecialWard |
+------+-----------------+------------+----------+---------+------------+----------------+-------------+------
------+----------------+-------------+
| pid | pname | DOB | phn_no | address | admit_date | discharge_date | doctor_name | consultant |
suffering_from | ward |
+------+-----------------+------------+----------+---------+------------+----------------+-------------+------
------+----------------+-------------+
| 6 | Adam levine | 2001-07-12 | 20202020 | Canada | 2017-04-02 | 2017-05-25 | Dr.Evin |
Dr.Root | Braintumor | SpecialWard |
| 7 | Adam Gillchrist | 2007-01-12 | 6666666 | England | 2014-04-02 | 2014-08-25 | Dr.Evin |
Dr.Root | Braintumor | SpecialWard |
+------+-----------------+------------+----------+---------+------------+----------------+-------------+------
------+----------------+-------------+
2 rows in set (0.00 sec)
+------+-----------------+------------+----------+----------+------------+----------------+-------------+-----
-------+----------------+-------------+
| pid | pname | DOB | phn_no | address | admit_date | discharge_date | doctor_name | consultant |
suffering_from | ward |
+------+-----------------+------------+----------+----------+------------+----------------+-------------+-----
-------+----------------+-------------+
| 4 | Charlie Puth | 2003-04-12 | 777777 | Columbus | 2018-05-02 | 2018-05-30 | Dr.Evin |
Dr.Root | spinal Injury | SpecialWard |
+-------------+--------------+
| doctor_name | pname |
+-------------+--------------+
| Dr.Onkar | Bruce Banner |
+-------------+--------------+
1 row in set (0.00 sec)
+-----------------+-------------+
| pname | consultant |
+-----------------+-------------+
| Bruce Banner | Dr.Kulkarni |
| Chris Ewans | Dr.jain |
| Chris Hemsworth | Dr.Stark |
| Tony Stark | Dr.Pollard |
| Charlie Puth | Dr.Root |
| Kane Williamson | Dr.Root |
| Adam levine | Dr.Root |
| Adam Gillchrist | Dr.Root |
+-----------------+-------------+
8 rows in set (0.00 sec)
mysql> select * from register where pid=(select pid from patient where pname="Bruce Banner");
+------+-----------+-----------+
| pid | test_name | result |
+------+-----------+-----------+
| 1 | CT SCAN | BLOOD CLOT |
+------+-----------+-----------+
1 row in set (0.01 sec)
+----------+
| count(*) |
+----------+
|1|
+----------+
1 row in set (0.00 sec)
14.Create view hospital data on patient table that will contain pid, name
referred by ward
+------+-----------------+---------------+
| pid | pname | ward |
+------+-----------------+---------------+ |
1 | Bruce Banner | SpecialWard | | 2 |
Chris Ewans | SpecialWard |
| 2 | Chris Hemsworth | SpecialWard | | 4
| Charlie Puth | SpecialWard | | 5 | Kane
Williamson | SpecialWard | | 6 | Adam
levine | SpecialWard | | 7 | Adam
Gillchrist | SpecialWard | | 8 | Linkin
Park | pediatricward |
+------+-----------------+---------------+ 8
rows in set (0.00 sec)