Computer Science, asked by rajani3083, 17 hours ago

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 Equestriadash
7

1. To create a database named 'db001'.

\tt Create\ database\ Db001;

2. To make the database active.

\tt Use\ Db001;

3. To create the given table.

\tt Create\ table\ Discount(ID\ int(3),\ N ame\ varch ar(20),\ Discount\ int,\\ Net\_Amount\ int);

4. To display the structure of the table.

\tt Desc\ Discount;

or

\tt Describe\ Discount;

5. To display all records of the table.

\tt Select\ *\ from\ Discount;

6. To delete the table.

\tt Drop\ table\ Sample;

  • 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 abhishekpaul2007
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