How do you create a primary key?



How do you create a primary key?..

Answer / Iltifat Ali Khan

To create a primary key in MySQL, you add the PRIMARY KEY keyword after the column names in the CREATE TABLE statement. Here is an example:n`nCREATE TABLE myTable (id INT PRIMARY KEY);n`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More MySQL Interview Questions

How can you see all indexes defined for a table?

1 Answers  


Write a query to fetch common records between two tables using mysql?

1 Answers  


How do I setup a mysql database?

1 Answers  


What can you do with mysql?

1 Answers  


What's new in mysql 8?

1 Answers  


I want to insert userid of a customer,order time,etc in a table called ordermaster with orderid as primary key.Same time the product codes and required quantities (a1,2 and a2 4 and so on)inserted in another table orderdetails with same orderid reference.How the code will be in JSP using MySQL?

1 Answers  


What are the reasons for selecting lamp (linux, apache, mysql, php) instead of combination of other software programs, servers and operating systems?

1 Answers  


Why to use char instead of varchar in the database?

1 Answers  


What is the difference between mysql_fetch_array and mysql_fetch_object?

4 Answers   CTS,


What is msql?

1 Answers  


How many ways we can we find the current date using MySQL?

5 Answers  


What is the difference between the DELETE TABLE and TRUNCATE TABLE commands in MySQL?

1 Answers  


Categories