Learn Python
Learn Data Structure & Algorithm
Learn Numpy
Learn Pandas
Learn Matplotlib
Learn Seaborn
Learn Statistics
Learn Math
Learn MATLAB
Learn Machine learning
Learn Github
Learn OpenCV
Learn Deep Learning
MySQL Introduction
MySQL Setup
MySQL Operators
MySQL Basic Works
MySQL Create Table
MySQL insert and get values
MySQL Condition
MySQL GROUP BY
MySQL Case
MySQL sorting and calculate avg,sum,count
MySQL Update
MySQL Time
MySQL String
MySQL Rollback & Commit
MySQL Join and Concatenate
MySQL Index
MySQL Date
MySQL View
MYSQL With Python
Learn MongoDB
Learn Web scraping
Learn Excel
Learn Power BI
Learn Tableau
Learn Docker
Learn Hadoop
You can't give space between a column name words. You can use underscore as a separator.
You must write the data type of each column beside column name and have to give a comma between columns.
The data type of string is varchar(in the bracket you have to write the number that how many letters a column
can take in a cell).
The data type of integer is int or bigint. You can store too many numbers in bigint and int can take 11
numbers.
The data types of date and time are:
DATE-->YYYY-MM-DD
TIME-->HHH:MM:SS or HH:MM:SS
DATETIME-->YYYY-MM-DD HH:MM:SS
TIMESTAMP-->YYYY-MM-DD HH:MM:SS
YEAR--> YYYY
You can pass any like DATE, DATETIME, etc according to you need.
DEFAULT""
If a missing value is in the column then the missing cell will fill by a default value null. If you want to
fill the missing cells with another default value then write DEFAULT" " beside the data type of that column
which column null value you want to change. Inside of the double quotation write the default value that you
want.
If you want that a column that can't have a missing value then write NOT NULL while creating that column .
If you want that a column can have unique values only then write UNIQUE while creating the column.
Suppose you have a table and in the table you have three columns id, books and price. By the id column you can uniquely identify the rows of the table. So id can be used as the primary key of the table. So we can say that, use or make primary key that column, by which you can uniquely identify each record or row of a table.
A FOREIGN key is used to link multiple tables together. A FOREIGN key in a table used to point The PRIMARY key
of another table. We do this so that we can connect multiple tables. We can say that to create a link between
multiple tables we use it.
Suppose you have a table that has three columns, ID, Product_name, and Name.
You have another column that has two columns, ID and Total_sell.
Here Id column of the second table points to the Id column of the first table.
Here Id column of the first table is the primary key and the Id column of the second table is the foreign key.
To set conditions use CHECK(condition). Here inside the bracket write the condition. You can use AND and OR to set multiple conditions.
Here we set the condition that the price column can have a value less than 100. It means that we only can't put value less than 100 in this column.
If you don't want to fill a column and you want that the column value will automatically increase and will
fill the row with that increased value, then use auto_increment.
Now we don't need to put value in the id column.