On DBMS Presentation.....
On DBMS Presentation.....
Aditya/SOE sec-23 1
Creating and dropping a database
SYNTAX:
CREATE DATABASE databasename;
SYNTAX:
DROP DATABASE databasename;
Aditya/SOE sec-23 2
USE DATABASE Statement
The use database statement is
used to access into database
SYNTAX
USE databasename;
SYNTAX
SHOW TABLES;
Aditya/SOE sec-23 3
Creating table
Example
Aditya/SOE sec-23 4
DESC command
This command is used to view the structure.
The MySQL’s DESCRIBE or DESC both are equivalent. The DESC is the
short form of DESCRIBE command and used to dipslay the information
about a table like column names and constraints on column name.
SYNTAX
DESC tablename;
OR
DESCRIBE tablename;
Aditya/SOE sec-23 5
DROP TABLE Command
This command is used to remove the entire structure of the table
and information. This is also from the DDL command.
Example
Aditya/SOE sec-23 6
Insert Command
Aditya/SOE sec-23 7
Select, Where, and From clause
SELECT
The SQL SELECT statement is used to fetch data from a database table which
returns this data in the form of a result table. We can also says the SELECT
statements is used to select data from a database. SYNTAX:
This command is used to view table information from SQL database. By using
SELECT command, we can get one or more fields information, while using *, one SELECT (*/field list)
can get all fields information.
FROM <table name>
[WHERE <condition>];
WHERE CLAUSE
The SQL WHERE clause is used to specify a condition while fetching the data from
a single table or by joining with multiple tables. If the condition is satisfied , then
only it returns a specific value from the table.
FROM CLAUSE
A WHERE clause in SQL specifies that a SQL Data Manipulation Language (DML)
statement should only affect rows that meet specified criteria.
Aditya/SOE sec-23 8
Distinct command
The DISTINCT keyword is used to remove duplicate values in a particular column .
Example
Aditya/SOE sec-23 9
UPDATE Command
This command is used to implement modification of the data values.
Example
Aditya/SOE sec-23 10
ALTER TABLE Command
This command is used to implement modification of the structure of the table. This is a DDL
command. Using this command, we can add a new column, remove the existing column and modify
data type of existing column.
Example
Aditya/SOE sec-23 11
DELETE Command
This command is used to remove information from a particular row or rows. Please
remember that this command will delete only row information but not the structure of the
table.
Example
Aditya/SOE sec-23 12