Home > database >  SQL to create the view.
SQL to create the view.

Time:11-19

Volunteers table:
- 1. Volunteers set up tables
The Create table volunteer
(stu_id varchar (10),
Stu_name varchar (10),
Stu_major varchar (10),
Stu_iphone varchar (10)
Primary key (stu_id));

- 1.1 the volunteer table insert data
Insert into volunteer values
(' 1 ', 'zhang', 'the letter tube 1', '111'),
(' 2 ', 'bill', 'the letter tube 1', '222'),
(' 3 ', 'Cathy', 'the letter tube 1', '333'),
(' 4 ', 'zheng jie playing', 'the letter tube 1', '444'),
(' 5 ', 'Li Lin', 'the letter tube 1', '555'),
(' 6 ', ', ', 'the letter tube 1', '666'),
(' 7 ', 'Chen Hong', 'the letter tube 1', '777'),
(' 8 ', 'sum cheung', 'fuse 2', '888'),
(' 9 ', 'Kui', 'fuse 2', '999'),
(' 10 ', 'a', 'fuse 2', '1010');

Insert into volunteer values (' 11 ', 'leitian', 'fuse 2', '1111');

During the:
- 2. Establish hotlist
The Create table activity (
Act_id varchar (10),
Act_name varchar (10),
Act_time varchar (10),
Act_place varchar (10),
Act_capacity varchar (10)
Primary key (act_id)
);

-- 2.1 data into the hotlist
Insert into the activity values
(' 001 ', 'good' one hundred ', '10.1', 'postal building', '100'),
(' 002 ', 'long south directly', '11.1', 'putuo temple', '50'),
(' 003 ', 'rubbish', '12.1', 'mingde building', '100'),
(' 004 ', 'bike', '05.1', 'three rice', '100'),
(' 005 ', 'sweeping', '09.1', 'hony floor', '100'),
(' 006 ', 'keep traffic', '05.1', 'god save the floor', '50'),
(' 007 ', 'clean desk', '04.1', 'seiko floor', '100'),
(' 008 ', 'file', '03.1', 'administration building', '90'),
(' 009 ', 'maintenance facilities',' 02.25 ', 'stadium', '100'),
(' 010 ', 'clean up the playground', '01.01', 'the playground', '50');

Application form:
- 3. Set up application form
The Create table sign (
Stu_id varchar (10),
Act_id varchar (10),
Sign_time varchar (10),
Stu_name varchar (10),
Act_name varchar (10),
Star_check_time varchar (50),
End_check_time varchar (50),
The Primary key (stu_id, act_id)
);

- delete this form
Drop table sign;

- 3.1 to insert data entry form
Insert into sign values
(' 1 ', '001', '9.25', 'zhang', 'one hundred' good, '10.1/10.1', '12.1/10.1'),
(' 2 ', '002', '10.10', 'bill', 'long south directly', '11.1/8.00', '11/1/11. 00),
(' 3 ', '003', '11.22', 'Cathy', 'rubbish', '12/1/8. 00', '12/1/12. 00),
(' 4 ', '004', '9.25', 'han-jen yu' and 'help bike', '05.1/10.00', '05.1/12.00'),
(' 5 ', '005', '10.10', 'li ZhanLin', 'sweeping', '09.1/8.00', '09.1/11.00'),
(' 6 ', '006', '11.22', 'WenLiuSen', 'keep traffic', '05.1/8.00', '05.1/12.00'),
(' 7 ', '007', '9.25', 'zhen-hong Chen', 'clean desk', '04.1/10.00', '04.1/12.00'),
(' 8 ', '008', '10.10', 'learning buddy', 'file', '03.1/8.00', '03.1/11.00'),
(' 9 ', '009', '11.22', 'Zhou Hongkui', 'maintenance facilities',' 02.25/8.00 ', '02.25/12.00'),
(' 10 ', '010', '12.22', 'William cheung', 'clean up the playground', '01.01/8.00', '01.01/10.00');

Problems of code:
- 3.8 create volunteer registration successful view
The create view f
As
Select Stu. Id, Act_id Act_name
The from volunteer, sign
Where volunteer. Stu_id=sign. Stu_id;
I would like to volunteer and sigh two tables to, through the Stu_id in appeared in the sign on the surface of the table volunteer information display, but SQL prompt can't bind multi-part identifier "Stu. Id,"

CodePudding user response:

The create view f
As
Select Stu. Id, Act_id Act_name
select volunteer. Stu_id, Act_id Act_name
Select sign. Stu_id, Act_id Act_name
the from volunteer, sign
Where volunteer. Stu_id=sign. Stu_id;


Any line in the scarlet letter

CodePudding user response:

Thank you
  • Related