How to create a new table? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to create a new table?

27th Mar 2017, 5:36 AM
Tanvir Ahmed Nabil
Tanvir Ahmed Nabil - avatar
7 Answers
+ 5
careful with varchar(255) it reserves the space in the database. so if you want to store small strings, only reserve what you need. that's important for really large databases, but it's a good practice to do it with all your tables. I've seen database where every column was of type text. even the integers. that's totally messed up...
27th Mar 2017, 6:16 AM
Mario L.
Mario L. - avatar
+ 3
Syntax CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, .... ); Example CREATE TABLE Persons ( PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) );
27th Mar 2017, 5:40 AM
Akwin Lopez
Akwin Lopez - avatar
+ 3
what's the meaning of 225?
27th Mar 2017, 6:06 AM
Tanvir Ahmed Nabil
Tanvir Ahmed Nabil - avatar
+ 3
225 refers to number of characters ..
27th Mar 2017, 6:38 AM
ZeroOne;
ZeroOne; - avatar
+ 1
how many bit it will be taken?
27th Mar 2017, 6:14 AM
Tanvir Ahmed Nabil
Tanvir Ahmed Nabil - avatar
+ 1
create tablename (Columnname1 datatype(size/length),Columnname2 ......)
27th Mar 2017, 10:29 AM
Siddharth Upadhyay
Siddharth Upadhyay - avatar
0
varcahr(255) length of the string value
27th Mar 2017, 6:10 AM
Akwin Lopez
Akwin Lopez - avatar