Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to create mysql student table

Shulou Source: shulou.com Published: 2022-05-31 14:16:42 10月01日 Update

Today, the editor will share with you the relevant knowledge points about how to create the mysql student table. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Title:

1. The construction table statement create table student (

Id varchar (20)

Name varchar (20)

Gender char (1)

Birth varchar (20)

Department varchar (20)

Address varchar (20)

) charset = utf8

two。 Insert data insert into student values

("201901", "Big Brother Zhang", "male", "1985", "Department of computer Science", "Haidian District, Beijing")

("201902", "Master Guo", "male", "1986", "Department of Chinese", "Changping District, Beijing")

("201903", "Zhang San", "female", "1990", "Chinese Department", "Yongzhou City, Hunan Province")

("201904", "Li Si", "male", "1990", "English Department", "Fuxin City, Liaoning")

("201905", "Wang Wu", "female", "1991", "English Department", "Xiamen City, Fujian Province")

("201906", "Wang Liu", "male", "1988", "computer Department", "Hengyang City, Hunan Province")

The results are as follows. ① the first step in solving the problem select

Department faculties

Case gender when "male" then 1 else 0 end male

Case gender when "female" then 1 else 0 end female

From student

The result is as follows: ② step 2 select

College and department

Sum male

Sum female

Total sum (male) + sum (female) as

From

(

Select department faculties

Case gender when "male" then 1 else 0 end male

Case gender when "female" then 1 else 0 end female

From student

) a

Group by faculty; the results are as follows

     

These are all the contents of the article "how to create the mysql Student form". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Knowledge articles departments results students Chinese Department content English Department computer Department Beijing Beijing Hunan Hunan Chinese English different very big chivalrous most of them Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi Microsoft Shulou Information Xiaomi