Creating the tables in SQL

5 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€46.74
List Price:  €65.44
You save:  €18.70
£40.02
List Price:  £56.04
You save:  £16.01
CA$68.38
List Price:  CA$95.74
You save:  CA$27.36
A$76.50
List Price:  A$107.11
You save:  A$30.60
S$68.11
List Price:  S$95.36
You save:  S$27.25
HK$391.33
List Price:  HK$547.90
You save:  HK$156.56
CHF 45.73
List Price:  CHF 64.03
You save:  CHF 18.29
NOK kr551.82
List Price:  NOK kr772.60
You save:  NOK kr220.77
DKK kr348.47
List Price:  DKK kr487.88
You save:  DKK kr139.41
NZ$84.17
List Price:  NZ$117.84
You save:  NZ$33.67
د.إ183.60
List Price:  د.إ257.06
You save:  د.إ73.45
৳5,499.99
List Price:  ৳7,700.43
You save:  ৳2,200.43
₹4,169.28
List Price:  ₹5,837.33
You save:  ₹1,668.04
RM238.42
List Price:  RM333.81
You save:  RM95.39
₦66,060.50
List Price:  ₦92,489.99
You save:  ₦26,429.48
₨13,909.47
List Price:  ₨19,474.37
You save:  ₨5,564.90
฿1,848.90
List Price:  ฿2,588.61
You save:  ฿739.70
₺1,625.07
List Price:  ₺2,275.23
You save:  ₺650.15
B$255.76
List Price:  B$358.08
You save:  B$102.32
R937.79
List Price:  R1,312.98
You save:  R375.19
Лв91.35
List Price:  Лв127.91
You save:  Лв36.55
₩68,890.62
List Price:  ₩96,452.39
You save:  ₩27,561.76
₪191.22
List Price:  ₪267.73
You save:  ₪76.50
₱2,881.72
List Price:  ₱4,034.64
You save:  ₱1,152.92
¥7,903.16
List Price:  ¥11,065.06
You save:  ¥3,161.90
MX$857.83
List Price:  MX$1,201.03
You save:  MX$343.20
QR182.17
List Price:  QR255.05
You save:  QR72.88
P689.81
List Price:  P965.79
You save:  P275.98
KSh6,639.79
List Price:  KSh9,296.24
You save:  KSh2,656.45
E£2,392.59
List Price:  E£3,349.82
You save:  E£957.23
ብር2,846.33
List Price:  ብር3,985.10
You save:  ብር1,138.76
Kz41,694.65
List Price:  Kz58,375.85
You save:  Kz16,681.20
CLP$47,408.51
List Price:  CLP$66,375.71
You save:  CLP$18,967.20
CN¥362.20
List Price:  CN¥507.11
You save:  CN¥144.91
RD$2,937.78
List Price:  RD$4,113.13
You save:  RD$1,175.34
DA6,708.56
List Price:  DA9,392.53
You save:  DA2,683.96
FJ$113.10
List Price:  FJ$158.35
You save:  FJ$45.25
Q388.59
List Price:  Q544.06
You save:  Q155.47
GY$10,484.28
List Price:  GY$14,678.83
You save:  GY$4,194.55
ISK kr7,026.59
List Price:  ISK kr9,837.79
You save:  ISK kr2,811.20
DH506.20
List Price:  DH708.72
You save:  DH202.52
L890.49
List Price:  L1,246.75
You save:  L356.26
ден2,874.95
List Price:  ден4,025.16
You save:  ден1,150.21
MOP$404.09
List Price:  MOP$565.76
You save:  MOP$161.67
N$957.24
List Price:  N$1,340.22
You save:  N$382.97
C$1,844.23
List Price:  C$2,582.07
You save:  C$737.84
रु6,681.04
List Price:  रु9,353.99
You save:  रु2,672.95
S/188.25
List Price:  S/263.57
You save:  S/75.31
K193.43
List Price:  K270.82
You save:  K77.39
SAR187.48
List Price:  SAR262.50
You save:  SAR75.01
ZK1,328
List Price:  ZK1,859.31
You save:  ZK531.30
L232.80
List Price:  L325.94
You save:  L93.14
Kč1,174.50
List Price:  Kč1,644.39
You save:  Kč469.89
Ft18,370.82
List Price:  Ft25,720.62
You save:  Ft7,349.80
SEK kr544.35
List Price:  SEK kr762.14
You save:  SEK kr217.78
ARS$43,693.47
List Price:  ARS$61,174.36
You save:  ARS$17,480.88
Bs347.54
List Price:  Bs486.59
You save:  Bs139.04
COP$198,223.63
List Price:  COP$277,528.94
You save:  COP$79,305.31
₡25,122.12
List Price:  ₡35,172.98
You save:  ₡10,050.86
L1,237.47
List Price:  L1,732.56
You save:  L495.08
₲372,019.98
List Price:  ₲520,857.74
You save:  ₲148,837.76
$U1,930.85
List Price:  $U2,703.34
You save:  $U772.49
zł201.68
List Price:  zł282.38
You save:  zł80.69
Already have an account? Log In

Transcript

Hello guys, I am Shahzad and welcome to lecture number 28. Today's we are going to discuss about the tables. How can you create your tables? How can you define the columns name? How can you define the data types for the columns? So now, with this statement, you can show all the databases available in your database.

I'm talking about the databases name, okay. So you know very well that we have our database, I'm saying use University database, that means I'm saying I'm going to work on this database. So as you can see, by default, it's here selected if I say that ACI use a CSS, it's a database name. Now, as you can see, the editor just changed the database. Now, if I say select static. From there, you can see you're showing me the tables available in the ACI database now I'm saying us University database because we are working on the union syllabus.

So now how can you create the tables we have created a table in our previous lectures, but using the CREATE TABLE statement, you can create the tables for your database for a particular database. Okay, now I'm saying SHOW TABLES. Okay, for now, as you can see, we have only two tables, I'm going to create the class tables, classes tables, okay, now I'm saying create tables. So this is the syntax to create a particular tables your table name here, you have to define your table name, and also the column name one, column name two, and so on. So now I'm saying I'm going to create the Colossus tables. And now the columns are I'm saying CL ID.

Make sure CL ID You have to define the data types also. Now I'm saying if St Peter and now I'm saying CLM. That means class name, class underscore name, I'm saying so var char, then you have to define how many characters you are assigning, I am saying 255. Now with the comma separated, you have to use a comma because this is the first column and this is the second column. Now, if you say that serial number, that means room number, I'm saying whom I'm also saying Indonesia, if you are going to store the values here, okay, now I'm saying it's 20 or hundred actually depend upon your requirement. So these are the basic three columns are so these are the data types available.

You can also use the data time, date time and also their time is Pam and also the year. So if I add the date here, I'm saying CL H, it's a date. And now what I need I just need to execute this query. You can also execute this query by clicking on the by right click and hit hit this button or the Execute button or as you can see, the editor is saying that please press the ctrl plus ENTER button to execute the current query. Same thing Ctrl Enter. Okay, now we have created the table name classes.

Now if I say SHOW TABLES so you can see now I'm here we have three tables in the database, which is the UDS database. We have created Tables if I'm saying select static from tables or fully from classes, so definitely it will return the empty because we have not inserted and record in this table. So you want to insert the record what you just need to add insert to insert into and classes. And then definitely you have to you have to specify the columns and you have Well, we'll discuss about this but for now we have successfully created a particular column or the particular database and also the columns. Now how can you drop your databases you have a syntax which is the drop then you have to use the table keyword and also the table name. So your table names here, Rob, we have created the table Which is the class table.

Now I'm saying drop tables and classes. So now Ctrl Enter. I'm saying SHOW TABLES. So as you can see, it's showing us the two tables, we have successfully created the tables and we have dropped a particular table which we have just created. So in this way you can create the tables and also you can drop any tables from your database. In the next lecture, we are going to cover that how can you alter your tables?

How can you add a particular column in existing tables? How can you drop a particular column so thank you for watching.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.