Get the App
SLTechnology News&Howtos  ›  Database  › 

Create tables in mysql database

Shulou Source: shulou.com Published: 2022-06-01 18:18:32 09月20日 Update

Create your own database and modify it accordingly.

Here is an example of a student scoring system:

create table info(

student_id int not null auto_increment, //will automatically add value, and it is the primary key

name char(10),

password char(8) not null default "12345678", //default setting is yes

chinese int(2) default 0,

math int(2) default 0,

english int(2) default 0,

Chemistry int(2) default 0,

Physics int(2) default 0,

time timestamp not null default current_timestamp, //will automatically get the time, do not need to insert

PRIMARY KEY (student_id)

)ENGINE=InnoDB DEFAULT CHARSET=utf8; //Set default encoding

insert data

insert into info(

student_id,name,password,chinese,math,english,Chemistry,Physics)

values

( "2016102401","Mr. Cai Xiao","19941024", 80, 90, 80, 89, 95);

Delete a row of data from a table

delete from info where student_id=2016102406;

//-------------------------------------

student_id | name | password | chinese | math | english | Chemistry | Physics | time |

+------------+--------------+----------+---------+------+---------+-----------+---------+---------------------+

| 2016102401 |Mr Cai Xiao| 19941024 | 80 | 90 | 80 | 89 | 95 | 2016-11-19 00:16:11 |

Tags: Data sir database one line example student situation time check score system code this is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn OPPO Reno Redmi Shulou Information