
- DBMS Tutorial
- DBMS - Home
- DBMS - Overview
- DBMS - Architecture
- DBMS - Data Models
- DBMS - Data Schemas
- DBMS - Data Independence
- Entity Relationship Model
- DBMS - ER Model Basic Concepts
- DBMS - ER Diagram Representation
- DBMS - Generalization, Aggregation
- Relational Model
- DBMS - Codd's Rules
- DBMS - Relational Data Model
- DBMS - Relational Algebra
- DBMS - ER to Relational Model
- DBMS- SQL Overview
- Relational Database Design
- DBMS - Database Normalization
- DBMS - Database Joins
- Storage and File Structure
- DBMS - Storage System
- DBMS - File Structure
- Indexing and Hashing
- DBMS - Indexing
- DBMS - Hashing
- Transaction And Concurrency
- DBMS - Transaction
- DBMS - Concurrency Control
- DBMS - Deadlock
- Backup and Recovery
- DBMS - Data Backup
- DBMS - Data Recovery
- DBMS Useful Resources
- DBMS - Quick Guide
- DBMS - Useful Resources
- DBMS - Discussion
Explain about Create, Insert, Select command in structure query language (DBMS)?
Query is a question or requesting information. Query language is a language which is used to retrieve information from a database.
Let’s see some of the structure query language (sql) commands used to perform operations on databases.
Create Command
The create command is used to create table, view, index.
The syntax for the create command is as follows −
Create table tablename(col1 datatype(size), col2 datatype(size),……….colN datatype(size));
For Example,
create table student(name char(30), regno number(10), branch char(20));
Output
The output is the table created below −
Name | Regno | Branch |
Example
Use the command given below −
create table employee(ename char(30), department varchar(20), age number(10), address varchar(20), Phone number(10));
Output
The output is as follows −
Ename | Department | Age | Address | Phone |
Describe Command
The command used to describe the table is desc.
Syntax
The syntax for the describe command is as follows −
desc tablename
Example 1
Use the command given below −
desc student
Description − It describes the structure / schema of a table.
The output is as follows −
Name | NULL | Type |
---|---|---|
Name | Char(30) | |
Regno | Number(10) | |
Branch | Char(20) |
Example 2
Use the command mentioned below −
desc employee
Description − It describes the structure/ schema of a table.
The output is as follows −
Name | NULL | Type |
---|---|---|
Ename | Char(30) | |
Department | Varchar(20) | |
Age | Number(10) | |
Address | Varchar(30) | |
Phone | Number(10) |
Insert Command
The command used to insert data into the table/view/index in the database using ‘insert’.
Syntax
The syntax for the insert command is as follows −
insert into tablename values(valu1,value2,value3,……valueN);
Example
Insert into student values (‘hari’, 100,’CSE’); Output − 1 row created
Insert into student values (‘pinky’, 101,’CSE’); Output − 1 row created
Insert into student values (‘bob’, 102,’CSE’); Output − 1 row created
Insert into student values (‘bhanu’, 103,’CSE’); Output − 1 row created
Insert into student values (‘bhanu’, 103,’CSE’); Output − 1 row created
Insert into student values (‘pinky’, 101,’CSE’); Output − 1 row created
Select Command
The command used to select columns is select.
Syntax
The syntax for the select command is as follows −
select column1, column2,…….coulmnN from tablename
Example 1
select name,regno,branch from student
Or
select * from student;
Output
Name | Regno | Branch |
---|---|---|
Hari | 100 | CSE |
Pinky | 101 | CSE |
Bob | 102 | CSE |
Bhanu | 103 | CSE |
Bhanu | 103 | CSE |
Pinky | 101 | CSE |
Example 2
Use the command given below −
select distinct name from student;
Description − It displays distinct names in sorted order.
Output
Name | Regno | Branch |
---|---|---|
Bhanu | 103 | CSE |
Bob | 102 | CSE |
Hari | 100 | CSE |
Pinky | 101 | CSE |
- Related Articles
- Explain about insert command in Structured query language in DBMS
- Explain Select command in DBMS
- What is a query language in DBMS?
- Explain about nested queries in DBMS
- Explain about concurrent transactions in DBMS
- Explain about conflict serializability in DBMS
- Insert with a Select query in MySQL
- Explain the use of delete command in DBMS
- Explain the select operation in relational algebra (DBMS)?
- Explain about 2NF with an example in DBMS
- Explain about triggers and active databases in DBMS
- Explain linear data structure queue in C language
- Explain about the Time stamp ordering protocol in DBMS
- Explain about two phase locking (2PL) protocol(DBMS)
- Explain the accessing of structure variable in C language
