Home Database Mysql Tutorial 学生表sid,sname,成绩表cid,cname,学生成绩表sid,cid,cscore,要

学生表sid,sname,成绩表cid,cname,学生成绩表sid,cid,cscore,要

Jun 07, 2016 pm 04:01 PM
student score

--1、建表SQL: --学生表: -- Createtable createtable STUDENT ( SID NUMBERnotnull, SNAME NVARCHAR2(40) ) tablespace CABLESCD pctfree10 initrans1 maxtrans255 storage ( initial64 minextents1 maxextentsunlimited ); --成绩表 -- Createtable creat

--1、建表SQL:

--学生表:

-- Createtable

createtable STUDENT

(

SID NUMBERnotnull,

SNAME NVARCHAR2(40)

)

tablespace CABLESCD

pctfree10

initrans1

maxtrans255

storage

(

initial64

minextents1

maxextentsunlimited

);

--成绩表

-- Createtable

createtable SCORE

(

CID NUMBERnotnull,

CNAME NVARCHAR2(40) notnull

)

tablespace CABLESCD

pctfree10

initrans1

maxtrans255

storage

(

initial64

minextents1

maxextentsunlimited

);

--学生成绩表

-- Createtable

createtableSTUDENGSCORE

(

SID NUMBERnotnull,

CID NUMBERnotnull,

CSCORE NUMBER(4,2)

)

tablespace CABLESCD

pctfree10

initrans1

maxtrans255

storage

(

initial64

minextents1

maxextentsunlimited

);

--2、插入SQL语句:

insert into student

(sid, sname)

values

(001,'ZHAOHY');

insert into student

(sid, sname)

values

(002, 'ZHANGQL');

insert into student

(sid, sname)

values

(003, 'ZHAOHB');

insert into score

(cid, cname)

values

(100, '数电');

insert into score

(cid, cname)

values

(200, '模电');

insert into score

(cid, cname)

values

(300, '英语');

insert into score

(cid, cname)

values

(400, '政治');

select * from score

(001, 100, '60');

insert into studengscore

(sid, cid, cscore)

values

(002, 100, '70');

insert into studengscore

(sid, cid, cscore)

values

(003, 100, '80');

insert into studengscore

(sid, cid, cscore)

values

(003, 200, '90');

insert into studengscore

(sid, cid, cscore)

values

(003, 300, '99');

insert into studengscore

(sid, cid, cscore)

values

(003, 400, '98');

select * from studengscore

--3、查询SQL

select * fromstudengscore;

select * from student;

select * from score;

select cnamefrom score where cid =(select cid fromstudengscore wherecscore=(

selectmax(cscore) fromstudengscore where sid=3 ));

\

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to write a simple student attendance management system using Java? How to write a simple student attendance management system using Java? Nov 02, 2023 pm 03:17 PM

How to write a simple student attendance management system using Java?

Which computer should Geographic Information Science majors choose? Which computer should Geographic Information Science majors choose? Jan 13, 2024 am 08:00 AM

Which computer should Geographic Information Science majors choose?

What are the effective ways to prevent students from being addicted to mobile phones? What are the effective ways to prevent students from being addicted to mobile phones? Jan 15, 2024 pm 06:15 PM

What are the effective ways to prevent students from being addicted to mobile phones?

Guangzhou plans to stipulate that primary and secondary schools can prohibit students from bringing mobile phones, and those allowed to bring in should be managed uniformly Guangzhou plans to stipulate that primary and secondary schools can prohibit students from bringing mobile phones, and those allowed to bring in should be managed uniformly Jun 16, 2024 pm 08:00 PM

Guangzhou plans to stipulate that primary and secondary schools can prohibit students from bringing mobile phones, and those allowed to bring in should be managed uniformly

How to implement a simple student test score ranking system using Java? How to implement a simple student test score ranking system using Java? Nov 02, 2023 pm 03:50 PM

How to implement a simple student test score ranking system using Java?

How to implement a simple student homework marking system in Java? How to implement a simple student homework marking system in Java? Nov 02, 2023 am 10:49 AM

How to implement a simple student homework marking system in Java?

How to use C++ to implement a simple student test score analysis program? How to use C++ to implement a simple student test score analysis program? Nov 02, 2023 pm 12:21 PM

How to use C++ to implement a simple student test score analysis program?

How does Class Optimization Master send results to parents? How does Class Optimization Master send results to parents? Feb 23, 2024 pm 08:50 PM

How does Class Optimization Master send results to parents?

See all articles