How to create Table in MySQL Schema or MySQL Database :
Let's say that you are working as MySQL Developer, MySQL Architect or MySQL DBA. An Excel file is provided to you with some information related to Customer with below columns
First Name,
Last Name,
Age,
Phone Number,
Data of Birth,
Sex
and you are asked to create Table in MySQL or MariaDB Schema or Database and save the data in newly created Table.
Create Table Syntax:
We can use create statement to create Table in MySQL Database. Below is Create StatementCreate Table Table_Name
(
Column_OneName DataType(Size if required),
Column_TwoName DataType(Size if required),
Column_ThreeName DataType(Size if required),
Column_FourName DataType(Size if required)
)
If we would like to create table with our above requirement, our Create Statement with be
CREATE TABLE `customer` (
`idcustomer` int(11) NOT NULL,
`firstname` varchar(50) NOT NULL,
`lastname` varchar(30) NULL,
`age` int(11) DEFAULT NULL,
`phonenumber` char(11) DEFAULT NULL,
`dob` date DEFAULT NULL,
`gender` char(1) NOT NULL
) ;
Before you write your create table statement, I suggest you to study the data type for each of the column. You will choose the data type for each of the column depending upon the data you would like to save in that column.
Here is little details what data types we have used for customer table columns and what type of data it will save.
VARCHAR(50) for First Name and Last Name : It will let us store characters and the max number will be 50.
TinyInt for Age: It will let us store integer value between 0 to 255.
CHAR(9) for PhoneNumber : Char will let us store characters, as we know that we need to store 9 Characters, we used Char(9).
Date for DOB: In Date of Birth column, we will be able to store date as we have data type= date.
Char(1) for Sex: As we would like to store M or F for Sex, Char is going to let us store single character.
Demo video : How to create table in MySQL or MariaDB Schema / Database
Mua vé tại đại lý vé máy bay Aivivu, tham khảo
ReplyDeletevé máy bay đi Mỹ khứ hồi
vé máy bay từ mỹ về việt nam bao nhiêu
ve may bay tu canada ve viet nam
vé máy bay nhật việt
gia ve may bay tu han quoc ve viet nam
Vé máy bay từ Đài Loan về VN
This comment has been removed by the author.
ReplyDeleteI can really say that study is always one the most important things for people. And for me as well i like the proccess and i like to help people. Of course there are some difficulties in shape of essays, care plans https://www.nursingpaper.com/our-services/nursing-care-plan-writing-service/ and other things, but i guess i will be able to handle with them any way possible. Overall i estimate my experience as very good you know
ReplyDeleteIt's important to approach online dating with respect and sincerity. Instead of using terms like "mail order polish bride," which can carry negative connotations, emphasize the idea of expanding horizons and connecting with people globally. Encourage forum readers to explore online dating for genuine connections, cultural exchanges, and the possibility of finding meaningful relationships to brighten their days.
ReplyDeleteDer Artikel über das Erstellen von Tabellen in MySQL oder MariaDB ist wirklich hilfreich! Als jemand, der gerade anfängt, mit Datenbanken zu arbeiten, fand ich die Schritt-für-Schritt-Anleitung sehr verständlich. Oft denkt man, dass Datenbankmanagement eine komplizierte Angelegenheit ist – fast wie ein märchen für erwachsene – aber dieser Beitrag zeigt, dass es auch für Einsteiger machbar ist. Die klaren Beispiele und Erklärungen haben mir sehr geholfen, das Konzept besser zu verstehen. Ich werde die Tipps auf jeden Fall ausprobieren, um meine eigene Datenbank zu erstellen. Vielen Dank für die nützlichen Informationen und die Motivation, weiterzulernen!
ReplyDelete