Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.8k views
in Computer by (25.1k points)

Explain DDL commands with example.

1 Answer

+1 vote
by (26.0k points)
selected by
 
Best answer

DDL -Data Definition Language commands create database objects such as tables, views, etc., The various DDL commands are Create Table, Alter Table, Create View, Drop Table.
-Create Table
SYNTAX:
CREATE TABLE table_name
( field1 datatype [ NOT NULL ],
field2 datatype [ NOT NULL ],
field3 datatype [ NOT NULL ]…)
An example of a CREATE TABLE statement follows.
SQL> CREATE TABLE BILLS (2 NAME CHAR(30),

3 AMOUNT NUMBER,
4 ACCOUNT_ID NUMBER);

The ALTER TABLE command is used to do two things:

  • Add a column to an existing table
  • Modify a column that already exists

SYNTAX:

ALTER TABLE table_name ADD( column_name data_type);
ALTER TABLE table_name MODIFY (column_name data_type);
The following command changes the NAME field of the BILLS table to hold 40 characters:
SQL> ALTER TABLE BILLS MODIFY (NAME CHAR(40));

DROP command is used to remove the entire table from the database.
syntax:
DROP TABLE tablename;
Example:
DROP TABLE student;

Related questions

0 votes
1 answer
asked Mar 31, 2020 in Computer by Punit01 (25.1k points)
0 votes
1 answer
0 votes
1 answer

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...