How to make column primary key in SQL

How to make column primary key in SQL

Okay everyone Now we will learn how to create a primary column in a MySQL database yes in a table.

okay here I will try to give an example I will create a table with the name customer_table then for the columns Customer_ID with the primary attribute then there is customer_name address and phone_number.

Okay, let's go straight to the method, first we create the table by creating a table then followed by the table name, namely customer table yes there is customer id customer_id So you can't use spaces, well customer id here I will use the Primary Key so the keyword is customer id the data type is integer for example not null primary so this must be typed Primary Key 

Okay so to see the primary we Des look for it in Describe the table name is customer table semicolon internet so this customer ID has become primary here yes okay that's all for this tutorial Thank you and see you guys

Conclusion
How to create a table with a primary key column:


create table customer_table(
customer_id int not null primary key,
customer_name varchar(25),
address varchar(50),
phone_number varchar(20));

0 Response to "How to make column primary key in SQL"

Posting Komentar