Q4. Write SQL commands for the following based on the given table “Discount”.
ID Name Discount Net_Amt
001 Neeraj 25 2000
002 Akshay 30 350
003 Meena 15 6500
1. To create a database named “db001”.
__________________________________________________________________
2. To make the database active.
__________________________________________________________________
3. To create the above mentioned table.
__________________________________________________________________
4. To display the structure of the table.
__________________________________________________________________
5. To display all records of the table.
__________________________________________________________________
6. To delete the given table.
____________________________________________________________________
Answers
Answered by
7
1. To create a database named 'db001'.
2. To make the database active.
3. To create the given table.
4. To display the structure of the table.
or
5. To display all records of the table.
6. To delete the table.
- Create database is a command used to create a database.
- Use is a command used to select a database.
- Create table is a command used to create a table. The attributes along with their data types. character limits and constraints are to be mentioned when creating a table.
- Desc/Describe is a command used to display the definition/structure of a table, showing each attribute's data type, character limit and constraint.
- Select is a command used to retrieve/display information from the table.
- The asterisk (*) represents all the data from the table. To retrieve records from specific columns, simply mention the column name(s) instead of the asterisk, each name separated by a comma if there are more than one.
- Drop table is a command used to delete a table from the database.
Answered by
0
Answer:
Explanation: SELECT - extracts data from a database.
UPDATE - updates data in a database.
DELETE - deletes data from a database.
INSERT INTO - inserts new data into a database.
CREATE DATABASE - creates a new database.
ALTER DATABASE - modifies a database.
CREATE TABLE - creates a new table.
Similar questions