Change table structure (add,edit,remove column of a table)at runtime
i. Add a column address in the EMP_SELECTION table.
ii. Execute SQL INSERT statement to create a record into EMP_SELECTION table
iii. run the query to updates all the records having GENDER as 'M', and increase
AGE of all the males by one year.
iv. Delete all the records from EMP_SELECTION Table where AGE is less than 18.
### Managing Table Structure and Data Operations in SQL and Python/C Lab
1. Changing Table Structure at Runtime
In SQL, changing the structure of a table, such as adding, editing, or removing columns, is typically done using `ALTER TABLE` statements. Below is how you can manage these operations.
#### i. Add a Column to the Table
To add a new column named `address` to the existing `EMP_SELECTION` table, use the following SQL statement:
```sql
ALTER TABLE EMP_SELECTION
ADD COLUMN address VARCHAR(255);
```
In this statement:
- `ALTER TABLE EMP_SELECTION`: Specifies the table to modify.
- `ADD COLUMN address VARCHAR(255)`: Adds a new column named `address` with a data type of `VARCHAR` and a maximum length of 255 characters.
#### ii. Execute SQL INSERT Statement to Create a Record
To insert a new record into the `EMP_SELECTION` table, use the `INSERT INTO` statement. For example, if you want to add a record with ____ ____ ___ _____ ________ __________ ______ ________ ______ __________ _________.
______ ______ _______ ______ _____ ______ ____ ______.
_____ ______ ____ ________ ____ _________ ______ _____ _________ _____ _______ ___.
____ ________ ________ ________ _____.
____ ______ _______ _____ ________ ______ __________.
_______ ____ ________ __________ ________ ________ __________ __________ _____.
__________ __________ _____ _____ ________ _______ _____.
___ ___ ____ _________ ________ ___ ___ __________ _________ _______.
______ ___ _________ _________ ______ ________ ________ ____ ________.
________ __________ ____ __________ _____ ____ ______ ______ ________ __________ _________.
____ ________ ___ __________ __________ _____.
_____ _______ ____ ______ _______ __________ _____ _________ _____ ______ ___ _________.
_____ ________ _____ _______ _________ __________.
________ _________ _________ __________ ___ _________ ________.
_______ _________ _________ ________ _______ __________ ___.
___ _______ ______ __________ _________ __________ _________.
______ __________ _______ ________ ________ ___ _______.
______ _____ ___ ________ ______ __________.
_________ __________ ____ ____ _______ ___ ____ __________.
___ ______ __________ ____ _____ ____ ________ __________ ____ ______.
____ _____ _____ ________ __________ ________ _____ ___ _______.
______ ___ _____ ____ _________ _____ _____ ____ _______ _________ ________ ________.
_________ ______ _____ __________ ______ _________.
___ ___ ____ _____ ________ __________ ________ _____.
________ _________ ___ ________ __________.
______ _____ _________ _________ ________ _________ _______ _______ _______ ____ _____ __________.
_________ ______ ______ _______ __________ ________ _________ _______.
______ _______ __________ ______ ________ _______ _____.
______ __________ _____ __________ ___ ____ ___ ________ ________ __________.
________ _____ ____ __________ ____ ______ _______.
_____ ___ _______ ____ ________ _____ _________ ___ __________ ____.
________ ________ _______ __________ ____ _____ _____ __________ _____ __________ ________ ____.
________ _____ _______ ________ __________ _____ ________ _________ ___ _____ _____.
___ ____ _______ ______ ____ _______ _______ _______ _________ ______ ___.
__________ __________ ___ _______ _________ _______ __________ _______.
__________ _________ _______ ____ ______ ______ ________ __________ ________ ______ ____.
________ _______ _____ _____ __________ _____ _______ ____.
___ _______ __________ __________ _______.
______ _______ ___ ________ ________ _______ ____ ____.
_____ ________ ________ _____ ______.
_____ ___ ________ ___ __________ _________ ____.
______ _______ _________ _______ _____ _____.
______ _________ _______ ____ ____ _________ ___ ___ _____ ___ _______.
__________ ____ ___ __________ ______ _____ ________ _________ ___.
_______ ___ ______ ______ _______ ____ ________ _____.
_______ _____ _______ _____ __________.
__________ _____ ___ ______ ________.
___ ___ __________ ___ ________ ________ ___.
__________ _____ ______ _______ ____ ______ ____ ____ _____.
____ __________ __________ ____ _________ ________ ____ _____ _____ ________.
______ ______ ____ ________ _________ _________ _______ ___ ____ _______.
__________ _______ _________ _________ _______ ________ __________ _______ ________ ________ _______.
_______ ____ ______ _________ ____ _______.
_________ ________ __________ ______ ______.
________ ________ __________ ___ ______ _______.
__________ _____ __________ ______ ________ ______ _____ __________ __________ _____ ____.
___ ________ _____ _____ ________.
___ _________ _________ ________ _____ ______.
_____ ___ __________ _______ __________ __________ ________ ________ ____ _________ ___.
_________ ___ ________ ___ __________ ______ ___.
___ _______ _____ _________ ________ ______ _______ _____ ________ _____ ____.
________ ____ ___ ________ ___ _______ ________ ____ ______ _________ ________.
_________ ______ ____ _____ ________ ____ __________ ________ __________.
______ ____ _________ ___ ___ _________.
____ ________ _____ ______ _______ _______ _____.
__________ ____ __________ _____ ________ _______ __________ ____ ____ ____ ___.
_____ _________ _______ __________ ________ ______.
___ ______ _____ ______ __________ _____ __________ __________ _____.
__________ ________ ____ _____ ___ _________ _____ _______ ____ _________ ___.
_____ _____ _______ _______ _______ _________ ___.
______ _____ __________ ___ ____ ____ ________ ____ _______ _____ ___ _____.
_____ ____ _________ __________ _________ ______ _________ ___ ______ ___ _____ _________.
_______ __________ _______ ___ ____ _____ ___ ____ ____ ___ _________.
________ _____ _________ _______ _______ _________ ___ _______ ______ _________.
___ _________ __________ ____ ___ _________ __________ _________ _______ ___ _____ ______.
__________ ___ __________ _________ __________ ________.
________ ___ ____ ___ _____ _______.
________ ___ _________ ___ ______ ____ ________ _______ ___ ___ ____.
__________ ______ __________ ________ ______ _________ _______ _______ ____.
__________ ____ _______ ____ ________ _______ _______.
_________ _________ __________ _____ _______ ___ _______ _________ __________ ____ _______.
__________ _________ __________ _______ ______ ________ _____ ______.
_______ ___ ___ _______ ____.
___ _________ ________ __________ __________ ______ ______ ___ _____ _______.
____ _____ ___ ___ _________ _________ ________ _____ ______.
_________ ____ ________ ________ _______ ______.
_____ ___ ___ ____ _______ ________ _________ ________ ________ ________.
____ ___ ______ ___ _______ ________ ______ ____ _______.
______ __________ _______ ______ _________ ______ __________ _____ ________.
______ ___ _________ ______ _____ ____.
______ ________ __________ _____ ______ ____ ____ _________ ______ ______ ________.
______ _____ _________ ________ _______ ___ _______ _____ ________ ______ __________ _____.
_________ ______.
Get Full Answer on WhatsApp