Add one or more columns from one table in a database to a column in another table--Hunt starling fly

Source: Internet
Author: User
Tags one table

field of the score table: Xueshenghao,yu,shu,yy are of type int. The new standard is the same as the Score table field, and the difference is that there is data in the score tables, but not in the new table (it is an empty table and none of the data). Requirements: Add the Yu,shu scores of each person in the score table to the new table. Database version mysql5.5.38.

CREATE TABLE ' Chengjibiao ' (
' Xueshenghao ' int (255) not NULL auto_increment,
' Yu ' int (255) DEFAULT NULL,
' Shu ' int (255) is DEFAULT NULL,
' yy ' int (255) DEFAULT NULL,
PRIMARY KEY (' Xueshenghao ')
) Engine=myisam DEFAULT CHARSET=GBK This is the table of achievement statement

This is the score table.

CREATE TABLE ' Newbiao ' (
' Xueshenghao ' int (255) not NULL auto_increment,
' Yu ' int (255) DEFAULT NULL,
' Shu ' int (255) is DEFAULT NULL,
' yy ' int (255) DEFAULT NULL,
PRIMARY KEY (' Xueshenghao ')
) Engine=myisam DEFAULT CHARSET=GBK This is the table statement for the new table

Implementation code: Insert Newbiao (Yu,shu) select Yu,shu from Chengjibiao;

Add one or more columns from one table in a database to a column in another table--Hunt starling fly

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.