A repo for basic MySQL Commands and for storing Lab Assignments.
SHOW DATABASES;
CREATE DATABASE database_name;
USE database_name;
DROP DATABASE database_name;
SHOW TABLES;
DESCRIBE table_name
or
DESC table_name
SELECT * FROM table_name;
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
DESCRIBE table_name;
DROP TABLE table_name;
TRUNCATE TABLE table_name;
ALTER TABLE table_name
ADD column_name datatype;
ALTER TABLE table_name
DROP COLUMN column_name;
ALTER TABLE table_name
MODIFY COLUMN column_name datatype;
or
ALTER TABLE table_name
ALTER COLUMN column_name datatype;
CREATE TABLE Persons (
ID int PRIMARY KEY,
FirstName varchar(255) NOT NULL,
AadharNo int UNIQUE,
City varchar(255) DEFAULT 'Mumbai',
Personid int IDENTITY(1,1)
Age int,
CHECK (Age>=18)
);
CREATE TABLE Orders (
OrderID int PRIMARY KEY,
OrderNumber int NOT NULL,
ID int,
FOREIGN KEY (ID) REFERENCES Persons(ID)
);
Client_master
product_master
salesman_master
sales_order
sales_order_details
challan_header
challan_details
Assignment List
Create ISSUE if you find any. PULL REQUESTS are welcomed.
Please use it responsibly. Thank you!