我要评分
获取效率
正确性
完整性
易理解

Creating a Database and Tables

Procedure

  1. Log in to the MySQL database.
    1
    mysql -u<User name> -p<Password>
    
  2. Create a database.
    create database <Database>;
  3. Create a table in the database.
    use <Database>;
    create table <Table name> (<Column name> <Data type>);

Example

  1. Log in to the MySQL database.
    1
    mysql -uroot -p
    
  2. Create a database.
    create database db1;
  3. Create a table in the database.
    use db1;
    create table tb1(username varchar(20) not null);