In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
There are two ways to create a primary key:
Create table table name (
Field name type
Field name type
……
Primary key (name)
);
Or
Create table table name (
Field name type primary key
Field name type
……
);
Note, however, that if you want to create a compound primary key, you cannot use the second way.
Here is a small example:
An error Multiple primary key defined is reported here, which means that multiple primary keys are defined. The correct way to write it is as follows:
If the item sets a compound primary key, the compound primary key is created and deleted at the same time, so you need to delete the primary key, but here you need to delete the primary key, and you need to delete the primary key first. If you don't delete the primary key first, you will report an error if you delete the primary key directly (as follows).
Self-increment needs to be deleted first:
Here, if we create a compound primary key, delete the normal index on the name field, and then create the compound primary key for both the stu_id and name fields:
Summary: there are two ways to create a primary key at the beginning of the article, the second way can not be used when creating a compound primary key; the compound primary key should be created and deleted at the same time.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 264
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.