0% found this document useful (0 votes)
5 views

Doctor Record

Uploaded by

aka711964
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Doctor Record

Uploaded by

aka711964
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

mysql> create database COMPUTERSCIENCE_12A;

Query OK, 1 row affected (0.02 sec)

mysql> use COMPUTERSCIENCE_12A;

Database changed

mysql> create table DOCTOR

-> (ID int,NAME char(20),DEPARTMENT char(20),GENDER char(1),EXPERIENCE int);

Query OK, 0 rows affected (0.05 sec)

mysql> insert into DOCTOR values

-> (101,'JOHN’,'ENT','M',12);

Query OK, 1 row affected (0.01 sec)

mysql> insert into DOCTOR values

-> (104,'SMITH','ORTHOPEDIC','M',5);

Query OK, 1 row affected (0.01 sec)

mysql> insert into DOCTOR values

-> (107,'GEORGE','CARDIOLOGY','M',10);

Query OK, 1 row affected (0.01 sec)

mysql> insert into DOCTOR values

-> (114,'LARA','SKIN','F',3);

Query OK, 1 row affected (0.01 sec)

mysql> insert into DOCTOR values

-> (109,'K.GEORGE','MEDICINE','F',9);

Query OK, 1 row affected (0.01 sec)

mysql> insert into DOCTOR values

-> (105,'JOHNSON','ORTHOPEDIC','M',10);
Query OK, 1 row affected (0.00 sec)

mysql> insert into DOCTOR values

-> (117,'LUCY','ENT','F',3);

Query OK, 1 row affected (0.01 sec)

mysql> insert into DOCTOR values

-> (111,'BILL','MEDICINE','F',12);

Query OK, 1 row affected (0.00 sec)

mysql> insert into DOCTOR values

-> (130,'MORPH','ORTHOPEDIC','M',15);

Query OK, 1 row affected (0.01 sec)

mysql> select * from DOCTOR;

+------+----------+------------+--------+------+

| ID | NAME | DEPARTMENT| GENDER | EXPERIENCE|

+------+----------+------------+--------+------+

| 101 | JOHN | ENT |M | 12 |

| 104 | SMITH | ORTHOPEDIC | M | 5|

| 107 | GEORGE | CARDIOLOGY | M | 10 |

| 114 | LARA | SKIN |F | 3|

| 109 | K.GEORGE | MEDICINE | F | 9|

| 105 | JOHNSON | ORTHOPEDIC | M | 10 |

| 117 | LUCY | ENT |F | 3|

| 111 | BILL | MEDICINE | F | 12 |

| 130 | MORPH | ORTHOPEDIC | M | 15 |

+------+----------+------------+--------+------+

9 rows in set (0.00 sec)

mysql> select NAME,DEPARTMENT,EXPERIENCE from DOCTOR order by EXPERIENCE desc;


+----------+------------+------+

| NAME | DEPARTMENT | EXPERIENCE |

+----------+------------+------+

| MORPH | ORTHOPEDIC | 15 |

| JOHN | ENT | 12 |

| BILL | MEDICINE | 12 |

| GEORGE | CARDIOLOGY | 10 |

| JOHNSON | ORTHOPEDIC | 10 |

| K.GEORGE | MEDICINE | 9 |

| SMITH | ORTHOPEDIC | 5 |

| LARA | SKIN | 3|

| LUCY | ENT | 3|

+----------+------------+------+

9 rows in set (0.00 sec)

mysql> select ID,NAME from DOCTOR;

+------+----------+

| ID | NAME |

+------+----------+

| 101 | JOHN |

| 104 | SMITH |

| 107 | GEORGE |

| 114 | LARA |

| 109 | K.GEORGE |

| 105 | JOHNSON |

| 117 | LUCY |

| 111 | BILL |

| 130 | MORPH |

+------+----------+

9 rows in set (0.00 sec)


mysql> select name from DOCTOR where gender='F' and EXPERIENCE>10;

+------+

| NAME |

+------+

| BILL |

+------+

1 row in set (0.00 sec)

mysql> select NAME,DEPARTMENT from DOCTOR where DEPARTMENT ='ENT' or DEPARTMENT


='MEDICINE';

+----------+----------+

| NAME | DEPARTMENT |

+----------+----------+

| JOHN | ENT |

| K.GEORGE | MEDICINE |

| LUCY | ENT |

| BILL | MEDICINE |

+----------+----------+

4 rows in set (0.00 sec)

mysql> select distinct DEPARTMENT from DOCTOR;

+------------+

| DEPARTMENT |

+------------+

| ENT |

| ORTHOPEDIC |

| CARDIOLOGY |

| SKIN |

| MEDICINE |

+------------+

5 rows in set (0.00 sec)


mysql> select count(distinct DEPARTMENT) from DOCTOR;

+----------------------+

| count(distinct DEPARTMENT) |

+----------------------+

| 5|

+----------------------+

1 row in set (0.01 sec)

mysql> select NAME, DEPARTMENT from doctor where GENDER='M' and NAME like's%';

+-------+------------+

| NAME | DEPARTMENT |

+-------+------------+

| SMITH | ORTHOPEDIC |

+-------+------------+

1 row in set (0.00 sec)

mysql> select NAME from DOCTOR where DEPARTMENT ='SKIN' or DEPARTMENT ='ORTHOPEDIC' or
DEPARTMENT ='CARDIOLOGY';

+---------+

| NAME |

+---------+

| SMITH |

| GEORGE |

| LARA |

| JOHNSON |

| MORPH |

+---------+

5 rows in set (0.00 sec)

You might also like