Consider the following table and answer the following : ID Department OPD_DAYS Doctor_Name H201 ENT MWF Akaash Arora H308 Oncology TTS Dharma Sharma H907 Paediatrics MWF Sanjay Singh (a) Identify suitable Primary Key from the above table. (b) Add a new record with the following data : (‘H608’, ‘Cardiology’, ‘TTS’, ‘Vinita Wahi’) (c) Write a select query to display records of those Doctors whose OPD_DAYS are ‘MWF’. 2
Answers
(b)
INSERT INTO <TABLE_NAME>
VALUES(‘H608’, ‘Cardiology’, ‘TTS’, ‘Vinita Wahi’);
(c)
SELECT * FROM <TABLE_NAME>
WHERE OPD_DAYS = 'MWF';
a) "ID" is the primary key column of the given table schema.
Primary Key :
- The primary key in a table of a database is a column that uniquely or distinctly identifies each row in the table.
- In simple terms, the value of the primary key column is different for each row in the table.
- Thus, it can be used to represent a row in a table.
Here, the columns in the table are ID, Department, Number of OPD Days, and Doctor Name. Each of the columns can have values that are common to multiple rows except the ID which is unique to a doctor. No two doctors can have the same value of ID.
Hence, ID is the primary key in this table.
b) Let the name of the given table be "TNAME", then the SQL query command to insert a row with given values in the table is :
INSERT INTO TNAME VALUES('H608', 'Cardiology', 'TTS', 'Vinita Wahi');
c) Here also we assume the table name as "TNAME". We need to select entire rows i.e. "*" on the basis of a condition on the OPD_DAYS column value. So, the SQL query for it is :
SELECT * FROM TNAME WHERE OPD_DAYS = 'MWF';
To learn more about SQL Queries, visit
https://brainly.in/question/49675350
#SPJ3