SQL语句

  • 创建新表
    create table employee(id int(100) primary key AUTO_INCREMENT, name varchar(255) DEFAULT NULL,departmentID int(100) not null);
    只有auto_increment用的是underscore?

  • 插入
    insert into employee(name,departmentID) values('Rafferty',31);
    insert into employee(name,departmentID) values('Rafferty',31),('Bobby',31);

  • 更改字段类型
    alter table employee modify id int(100) auto_increment;

  • 更改表名【表的基本信息用alter】
    alter table deparment rename department;

  • 更改字段值【具体值用update】
    update employee set name='Fitz' where id =2;
    还可以用replace哦!

你可能感兴趣的:(SQL语句)