Oracle Decode function usage

Source: Internet
Author: User

A table is knownTThe structure is as follows:

TableT

Name

Subject

Score

Varchar2 (10)

Varchar2 (10)

Number (3)

Cannot be blank

Cannot be blank

 

(1)Create a table named according to the known table structureT1Table,Write and create a tableT1OfSQLStatement.

Create table t1

(

NameVarchar2 (10) not null,

SubjectVarchar2 (10) not null,

ScoreNumber (3)

(2)Forward tableTInsert the following data,And write the insertedSQLStatement

Data:

Zhang San Chinese20
James math30
Zhang SanPhysical50
Li Si Chinese70
Li Si mathematics60
Li Si Physical90

Insert into t1 values ('Zhang San','Chinese', 20 );

Insert into t1 values ('Zhang San','Mathematics', 30 );

Insert into t1 values ('Zhang San','Physical', 50 );

Insert into t1 values ('Li Si','Chinese', 70 );

Insert into t1 values ('Li Si','Mathematics', 60 );

Insert into t1 values ('Li Si','Physical', 90 );

 

(3)InPL/SQLHow to passSelectStatement to change it to the following structure

Name, Chinese, Mathematics, Physics
Zhang San203050
Li Si706090

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.