Databases..
1. Create Database :
- A database is used to store the collection of records in an organized form.
- It allows us to hold the data into tables, rows, columns, and indexes to find the relevant information frequently.
- We can access and manage the records through the database very easily.
Syntax :
CREATE DATABASE mydb;
2. Drop Database :
- The DROP DATABASE statement is used to drop an existing SQL database.
Syntax :
DROP DATABASE databasename;
3. Select Database :
- Select Database use to select particular database which available in Databases.
Syntax :
USE databasename;
4. Show Database :
- Show Database use to show list of all databases which available in Databases.
Syntax :
SHOW databasename;
Tables in Mysql
1. Create Table :
- The CREATE TABLE statement is used to create a new table in a database.
Syntax :
CREATE TABLE table_name (
column1 datatype,
);
2. Drop Table :
- The DROP TABLE statement is used to drop an existing table in a database.
Syntax :
DROP TABLE table_name;
3. Truncate Table :
- The TRUNCATE TABLE statement is used to delete the data inside a table, but not the table itself.
Syntax :
TRUNCATE TABLE table_name;
4. Alter table Statement :
- The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
- The ALTER TABLE statement is also used to add and drop various constraints on an existing table.
- Add column :
Ex :
ALTER TABLE Customers
ADD Email varchar(255);
- Drop Column :
Ex :
ALTER TABLE Customers
DROP COLUMN Email;