sql数据库多表查询
发布网友
发布时间:2022-04-22 21:32
我来回答
共1个回答
热心网友
时间:2022-04-10 01:35
1.
select
st.StudentNumber,
st.Name,
count(*)
from
student st,
sbook sk
where
st.StudentNumber=sk.StudentNumber
and to_char(sk.BorrowingTime,'yyyy')='2008'
group by
st.StudentNumber,
st.Name
2.
select
b.BookNumber,
b.BookName,
st.Name,
sk.BorrowingTime,
sk.ShouldReturnTime
from
student st,
sbook sk,
book b
where
st.StudentNumber=sk.StudentNumber
and sk.BookNumber = b.BookNumber
and month(sk.BorrowingTime) =month(sysdate)
3.
Create view yourViewName as
select
b.BookNumber,
b.BookName,
st.Name,
sk.BorrowingTime,
sk.ShouldReturnTime
from
student st,
sbook sk,
book b
where
st.StudentNumber=sk.StudentNumber
and sk.BookNumber = b.BookNumber
and month(sk.BorrowingTime) =month(sysdate)
没运行过可能有点问题