當前位置:首頁 » 操作系統 » 資料庫社團

資料庫社團

發布時間: 2022-11-29 07:13:57

1. 社團管理系統用文件存儲不能用資料庫

我最初沒學過資料庫時,我就想用資料庫(access),那時,是我在剛學完C語言,寫一個學生管理系統的程序(dos窗口那種),當時是用文件,讀寫文件來實現。後來還沒學資料庫時,我用資料庫代替我原來的文件。也就是我只用資料庫來保存數據而已。 ...

2. 在職工-社團資料庫有3個基本表:職工(職工號,姓名,年齡,性別);

1,社會團體(編號,名稱,負責人,活動地點) society
參加(職工號,編號,參加日期)Join
職工(職工號) Employee

select 職工號
from Employee a
where a.職工號 in(select 職工號 from Join
where 編號 in(select 編號 from Join
where 職工號='1001'));
2,select (select 名稱 from society where 編號=Join.編號) 社會團體名稱,
sum(職工編號) 參加人數
from Join where 編號 =
(select bb.編號 from (select 編號,count(*) 數量 from Join group by 編號 ) bb
where bb.數量 =( select max(數量) from --得到最大數量
(select 編號,count(*) 數量 from Join
group by 編號 ) aa ) ); --根據最大數量得到團體編號
3,grant select, insert, delete on society to 李平 with grant option;
grant select, insert, delete on Join to 李平 with grant option;

3. 設教工社團資料庫有三個基本表:

1. select distinct a.工號, a.姓名 from 職工 a, 社團 b, 參加 c
where a.工號=c.工號
and c.編號=b.編號
and b.名稱 in ('體操隊','籃球隊')
2. select distinct a.工號, a.姓名, a.年齡 from 職工 a
where a.性別='男' and exists
(select 1 from 參加 b where b.工號=a.工號)
3. select a.工號 from 職工 a
where a.工號 in
(select b.工號 from 參加 b group by b.工號 having count(*) > 2)
4. select a.* from 職工 a
where not exists ( select * from 社團 b where not exists
(select * from 參加 c where c.工號=a.工號 and c.編號=b.編號)
)

4. sql資料庫的創建表

第一題不知道為什麼網路說有不合適內容不給我提交。

二、寫出SQL語句:(各10分,共50分)

1.select distinct no,name from table where 2010-year(birth) >=50;
2.select no,name from table where livecity=workingcity;
3.select no,name from table where company!='聯華公司';
4.create view emp_female as select e#,ename,c#,cname,salary from emp group by e#;
5.use emp
go
update emp set salary=salary+0.5*salary;

我無語了 做了好幾題都說有不適合發表的內容 我都不知道哪些語句是不適合發表的- -明明是資料庫語句啊

二、寫出SQL語句:
1、建立視圖:社團負責人(編號,名稱,負責人職工號,負責人姓名,負責人性別);
2、建立視圖:參加人情況(職工號,姓名,社團編號,社團名稱,參加日期)
3、查找參加唱歌隊或籃球隊的職工號和姓名。
4、求參加人數最多的社會團體的名稱和參加人數。
5、把對社會團體和參加兩個表的數據查看、插入和刪除數據的權力賦給用戶李平,並允許他將此權力授予其他用戶
create view 社團負責人(編號 char(7),名稱 char(8),負責人職工號 char(8),負責人姓名 char(8),負責人性別 char(2));
create view 參加人情況(職工號,姓名,社團編號,社團名稱,參加日期);
select 職工號,姓名 where 社團名稱=『唱歌隊』or『籃球隊』;
select count(*) max(名稱),max(社團名稱) from 參加人情況 ;
grant select,insert,delete on 社會團體and參加人數 to 李平 with admin option;

5. 給資料庫社團起個好聽的名字,誰來幫我想想!!

DB COVER 就是Discovers (DATABASE)new continent

6. 求資料庫,關於學生社團管理系統,JAVA web前段加MySQL資料庫,事後定當答謝

可以幫你做一個

7. SQL資料庫 職工(職工號,姓名,年齡,性別) 社會團體(編號,名字,負責人,活動地點,會費)

--1
update[社會團體]
set[會費]=[會費*1.1]
--2
createviewUVW_testas
select[名字],[總人數]from[社會團體]Arightjoin(select[編號],count(*)[總人數]from[參加]groupby[編號])B
onA.[編號]=B.[編號]
--3
select[編號],[名稱],[負責人]from[社會團體]
where[編號]notin(select[編號]from[參加])

8. 設職工社團資料庫有三個基本表: 職工(職工號,姓名,年齡,性別); 社會團體(社團號,名稱,負責人

--設職工社團資料庫有三個基本表:
-- 職工(職工號,姓名,年齡,性別);
-- 社會團體(社團號,名稱,負責人,活動地點)
--參加(職工號,社團號,參加日期)
---其中: (1)職工表的主碼為職工號。
--(2)社會團體表的主碼為社團號;外碼為負責人,被參照表為職工表,對應屬性為職工號。
--(3)參加表的職工號和社團號為外碼;職工號為外碼,其被參照表為職工表,對應屬性為職工號;
--社團號為外碼,其被參照表為社會團體表,對應屬性為社團號。
--試用SQL語句表達下列操作:
---1.定義職工表、社會團體表和參加表,並說明其主碼和參照關系。
create table em
(
emid varchar(5) primary key,
emname nvarchar(5) not null,
age int,
sex nchar(1))

create table team
(
tid char(3) primary key,
tname nvarchar(10) not null,
leader varchar(5) foreign key references em(emid),
workstation nvarchar(20)
)

create table takepartin
(emid varchar(5) foreign key references em(emid),
tid char(3) foreign key references team(tid),
takedate smalldatetime,
primary key(emid,tid))
--- 2.建立下列兩個視圖: 社團負責人(社團號,名稱,負責人職工號,負責人姓名,負責人性別);
create view leaders
as
select tid,tname,em.emid,emname,sex from team join emp on team.emid=team.leader;
----參加人情況(職工號,姓名,社團號,社團名稱,參加日期)。
create view takes
as
select A.emid,emname,c.tid,tname,takedate from emp A join takepartin B on a.emid=B.emid
join team C on B.tid=C.tid
--3.查找參加的職工號和姓名。
select emid,emname from takes where tname='唱歌隊' or tname='籃球隊'
---4.查找沒有參加任何社會團體的職工情況。
select * from emp where emid not in(select emid from takepartin)
--5.查找參加了全部社會團體的職工情況。

熱點內容
全名k歌安卓手機裡面怎麼錄屏 發布:2024-05-17 14:40:07 瀏覽:180
常用資料庫介紹 發布:2024-05-17 14:31:38 瀏覽:504
中孚存儲介質信息消除工具 發布:2024-05-17 14:31:33 瀏覽:588
伺服器訪問ip如何調轉主頁 發布:2024-05-17 14:30:33 瀏覽:788
好玩的解壓化妝小游戲 發布:2024-05-17 14:10:57 瀏覽:127
交通銀行怎麼登陸不了密碼 發布:2024-05-17 13:54:48 瀏覽:543
安卓如何自動連接無線 發布:2024-05-17 13:53:51 瀏覽:262
python的urlparse 發布:2024-05-17 13:44:20 瀏覽:769
linux命令全稱 發布:2024-05-17 12:07:54 瀏覽:110
ftpnas區別 發布:2024-05-17 12:06:18 瀏覽:949