자바 고주파 기본 면접 질문——(9)
자격을 갖춘 Java 백엔드 개발자가 되려면 데이터베이스 지식이 필수적입니다. 데이터베이스에 대한 친숙도 검사는 기본 능력이 탄탄한지 여부에 대한 검사이기도 합니다.
(더 많은 관련 면접 질문 추천: java 면접 질문 및 답변)
특히 주니어 개발자의 경우 면접에서 프레임워크 관련 지식은 묻지 않을 수 있지만, 데이터베이스 지식을 조사하는 데는 절대 실패하지 않을 것입니다. SQL 문의 유형은 일상적인 개발이나 인터뷰 준비에 도움이 될 것입니다.
기본 테이블 구조:
student(sno,sname,sage,ssex)学生表 course(cno,cname,tno) 课程表 sc(sno,cno,score) 成绩表 teacher(tno,tname) 教师表
101, 1코스 성적이 2코스 성적보다 높은 모든 학생의 학생 ID를 쿼리합니다
select a.sno from (select sno,score from sc where cno=1) a, (select sno,score from sc where cno=2) b where a.score>b.score and a.sno=b.sno
102, 평균 성적이 2코스보다 높은 학생의 학생 ID와 평균 성적을 쿼리합니다. 60점
select a.sno as "学号", avg(a.score) as "平均成绩" from (select sno,score from sc) a group by sno having avg(a.score)>60
103, 학생 번호, 이름, 수강한 과목 수 및 모든 학생의 총점을 확인하세요
select a.sno as 学号, b.sname as 姓名, count(a.cno) as 选课数, sum(a.score) as 总成绩 from sc a, student b where a.sno = b.sno group by a.sno, b.sname
또는:
selectstudent.sno as 学号, student.sname as 姓名, count(sc.cno) as 选课数, sum(score) as 总成绩 from student left Outer join sc on student.sno = sc.sno group by student.sno, sname
104, "Zhang"이라는 교사의 수를 확인하세요
selectcount(distinct(tname)) from teacher where tname like '张%‘
또는:
select tname as "姓名", count(distinct(tname)) as "人数" from teacher where tname like'张%' group by tname
105, "Zhang San" 수업을 수강하지 않은 학생의 학번과 이름을 쿼리하세요.
select student.sno,student.sname from student where sno not in (select distinct(sc.sno) from sc,course,teacher where sc.cno=course.cno and teacher.tno=course.tno and teacher.tname='张三')
(추천 학습: java 강좌)
106, 학생 번호와 이름을 쿼리하세요. 코스 1과 코스 2를 모두 공부한 학생 수
select sno, sname from student where sno in (select sno from sc where sc.cno = 1) and sno in (select sno from sc where sc.cno = 2)
또는
selectc.sno, c.sname from (select sno from sc where sc.cno = 1) a, (select sno from sc where sc.cno = 2) b, student c where a.sno = b.sno and a.sno = c.sno
또는
select student.sno,student.sname from student,sc where student.sno=sc.sno and sc.cno=1 and exists( select * from sc as sc_2 where sc_2.sno=sc.sno and sc_2.cno=2)
107, "Li Si"가 가르치는 모든 코스를 공부한 모든 학생의 학생 ID와 이름을 쿼리합니다.
select a.sno, a.sname from student a, sc b where a.sno = b.sno and b.cno in (select c.cno from course c, teacher d where c.tno = d.tno and d.tname = '李四')
또는:
select a.sno, a.sname from student a, sc b, (select c.cno from course c, teacher d where c.tno = d.tno and d.tname = '李四') e where a.sno = b.sno and b.cno = e.cno
108, 코스 번호 1의 점수가 코스 번호 2의 점수보다 높은 모든 학생의 학생 번호와 이름을 쿼리합니다.
select a.sno, a.sname from student a, (select sno, score from sc where cno = 1) b, (select sno, score from sc where cno = 2) c where b.score > c.score and b.sno = c.sno and a.sno = b.sno
109, 모든 학생의 학생 번호와 이름을 쿼리합니다.
select sno,sname from student where sno not in (select distinct sno from sc where score > 60)
110 과목에서 점수가 60점 미만이고 하나 이상의 과목을 쿼리합니다. 1번 학생과 동일한 과목을 수강하는 학생의 학번 및 이름
select distinct a.sno, a.sname from student a, sc b where a.sno <> 1 and a.sno=b.sno and b.cno in (select cno from sc where sno = 1)
또는:
select s.sno,s.sname from student s, (select sc.sno from sc where sc.cno in (select sc1.cno from sc sc1 where sc1.sno=1)and sc.sno<>1 group by sc.sno)r1 where r1.sno=s.sno
관련 권장 사항: Java 입문 튜토리얼
위 내용은 자바 고주파 기본 면접 질문——(9)의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Java의 난수 생성기 안내. 여기서는 예제를 통해 Java의 함수와 예제를 통해 두 가지 다른 생성기에 대해 설명합니다.

Java의 Weka 가이드. 여기에서는 소개, weka java 사용 방법, 플랫폼 유형 및 장점을 예제와 함께 설명합니다.

Java의 Smith Number 가이드. 여기서는 정의, Java에서 스미스 번호를 확인하는 방법에 대해 논의합니다. 코드 구현의 예.

이 기사에서는 가장 많이 묻는 Java Spring 면접 질문과 자세한 답변을 보관했습니다. 그래야 면접에 합격할 수 있습니다.

Java 8은 스트림 API를 소개하여 데이터 컬렉션을 처리하는 강력하고 표현적인 방법을 제공합니다. 그러나 스트림을 사용할 때 일반적인 질문은 다음과 같은 것입니다. 기존 루프는 조기 중단 또는 반환을 허용하지만 스트림의 Foreach 메소드는이 방법을 직접 지원하지 않습니다. 이 기사는 이유를 설명하고 스트림 처리 시스템에서 조기 종료를 구현하기위한 대체 방법을 탐색합니다. 추가 읽기 : Java Stream API 개선 스트림 foreach를 이해하십시오 Foreach 메소드는 스트림의 각 요소에서 하나의 작업을 수행하는 터미널 작동입니다. 디자인 의도입니다

Java의 TimeStamp to Date 안내. 여기서는 소개와 예제와 함께 Java에서 타임스탬프를 날짜로 변환하는 방법에 대해서도 설명합니다.
