Skip to content

Instantly share code, notes, and snippets.

@soiqualang
Last active December 21, 2020 10:11
Show Gist options
  • Save soiqualang/3a4fa0faa1992c3ea91ae7aedd9503b9 to your computer and use it in GitHub Desktop.
Save soiqualang/3a4fa0faa1992c3ea91ae7aedd9503b9 to your computer and use it in GitHub Desktop.
Notes MySQL
@soiqualang
Copy link
Author

soiqualang commented Dec 21, 2020

Một số lưu ý khác

Cột khóa chính thường không được phép null NOT NULL và được cho tự động tăng AUTO_INCREMENT

ALTER TABLE
  clients
ALTER COLUMN
  phone

Cú pháp chuẩn lúc tạo bảng

CREATE TABLE Persons (
    Personid int NOT NULL AUTO_INCREMENT,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int,
    PRIMARY KEY (Personid)
);

https://chartio.com/resources/tutorials/how-to-alter-a-column-from-null-to-not-null-in-sql-server/
https://www.w3schools.com/sql/sql_autoincrement.asp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment