Add the following fields in the Table ‘SUBJECT’ – SUBJECT_ID, SUBJECT_NAME, AUTHOR_ID. Add 15 records in the table.
To add the fields SUBJECT_ID, SUBJECT_NAME, and AUTHOR_ID to the existing SUBJECT table, and insert 15 records into it, we would follow a series of steps in a practical database management context, specifically using SQL.
Step 1: Alter the Table to Add New Columns
To begin, you need to modify the structure of the existing table to include the new fields. In SQL, the ALTER TABLE command is used to make changes to an existing table's structure. The command will add three new columns to the SUBJECT table:
ALTER TABLE SUBJECT ADD COLUMN SUBJECT_ID INT PRIMARY KEY, ADD COLUMN SUBJECT_NAME VARCHAR(255), ADD COLUMN AUTHOR_ID INT; SUBJECT_ID INT PRIMARY KEY: This field is used to uniquely identify each subject. It is defined as an integer and will serve as the primary key.SUBJECT_NAME VARCHAR(255): This field stores the name of the subject. TheVARCHARdata type is used for variable-length strings, and255denotes the maximum number of characters.AUTHOR_ID INT: This field stores the ID of the author associated with each subject. It is defined as an integer.
Once this command is executed, the SUBJECT table will have three new columns.
Step 2: Insert Records into the Table
Now that the table structure has been updated, we can add 15 records into the SUBJECT table. Each record will include a unique SUBJECT_ID, the name of the subject, and an associated AUTHOR_ID. The AUTHOR_ID can either be a reference to an existing table (if there is an AUTHOR table), or it can be a direct integer value representing the author's identity.
The following SQL INSERT statements will add 15 records into the table:
INSERT INTO SUBJECT (SUBJECT_ID, SUBJECT_NAME, AUTHOR_ID) VALUES (1, 'Database Management Systems', 101), (2, 'Object-Oriented Programming', 102), (3, 'Data Structures and Algorithms', 103), (4, 'Operating Systems', 104), (5, 'Computer Networks', 105), (6, 'Software Engineering', 106), (7, 'Artificial Intelligence', 107), ________ _______ ______ ____ ________ _________ _________ ___ ____ ______.
___ ________ _______ ______ _________ ______ _______ ____ __________.
__________ ____ __________ _______ ___.
__________ ____ _____ ________ _____ ________ ________ ________.
_________ ________ ___ __________ ______ ___ ___ ____.
________ __________ _______ _____ ___ _________ _____ _________ ________.
____ _______ ___ ________ ____ ________ ____ _____ _________ ______ ____.
_____ _______ ______ ___ __________ ______ ___ __________ ________ _________.
_________ ________ ____ _____ _________ ________.
_________ _______ __________ _________ ________ ______ _______ _____ ________ _________ ________.
_______ ____ ___ _______ _______ ________ _______ _________ _____ _____.
________ ________ _______ _______ __________ ________.
_____ ______ __________ ___ __________ _________ _____ ________ __________ ______ _________.
________ _________ __________ __________ ___ __________ ________ _________ ________ _______ ____ ______.
____ ____ ___ ___ ________ ____ _________ __________ ______ __________ _______ __________.
______ ___ _________ ______ _____ ___ ___ ________ _____.
_______ __________ ______ __________ _______ _________ _________ _______ _________ ______.
______ __________ _______ ___ ______ ______ __________ ___ ___ ______ _________ ________.
_______ __________ ___ ______ _________ ___ ________.
_________ _______ ___ ____ _____ ___.
___ ______ ___ ________ _________ _______.
___ __________ ____ _____ ____.
____ _____ _________ ______ __________ _____ ___ ______ ________ _____ _______.
______ ____ _____ _____ _________ __________.
__________ ____ _____ ___ _______ ________ _________.
_______ _________ ____ ____ ________ _______.
_____ _____ ________ ______ ______ ____ _______.
_____ __________ _____ __________ _______.
_________ _________ ________ _________ ______ _______ __________ _______ __________ ___.
_________ ___ ______ ________ _______.
_______ ______ ___ ___ ___ ___ _______ __________ ___ ____ _____ _____.
_____ _____ ____ _________ ________ _____ ______ ______.
___ _________ ______ __________ __________ _________ ___.
__________ ________ ________ ________ ___ ________.
_____ _________ ____ ____ _______ _______ ___ ____ _______ ________ _______.
_____ _______ __________ _________ ___ _______ ______.
______ ________ ________ _______ _______ __________.
______ _______ _________ ________ ____ __________ ____.
_____ _______ ____ ______ ________ __________ ______ __________ _____ _____ ____ __________.
______ _____ _______ ____ _________ _________ ______ _____ ___ ____ _____ _________.
______ ____ _________ _____ ______ ___ __________ ______ ______ _________.
________ ____ _________ _________ ________ ________.
______ __________ ______ _________ _____ _______ __________ _________ ___ _________ _________ ____.
_______ _________ ______ ____ __________ _________ ____ __________ _____ ________ ________ _____.
__________ ____ ___ _____ __________ _____.
____ _________ ________ ______ _________ _____ ___ ____.
_________ ____ __________ _______ _________ ________ _____ ______.
_____ ___ ____ _______ ______ ___ ___ _______.
_________ _______ _________ __________ _______ ______ ___ _______ _______ ______ ______.
_________ ______ ______ _____ ______ _____.
___ ____ _______ ___ ______ ___ ________ ______ ____.
______ _____ ________ _____ ____ ____ _________ _____ _____ _______ __________ ____.
___ ______ ____ ___ ____ ___.
________ ________ __________ _______ _____ ____.
__________ _____ ___ ___ _______ __________ ______ ________ ____.
______ _________ _______ _______ __________ ____ ______ __________ _______ __________ ______.
_________ __________ __________ ___ ______.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
✓ Unlock up to 60% of the answer
✓ No payment required