Java で頻繁に聞かれる基本的な面接の質問—(9)
Java バックエンド開発者の資格を取得するには、データベースの知識が不可欠であり、データベースに精通しているかどうかの試験は、その人が確実な基礎スキルを備えているかどうかの試験でもあります。
(より関連した面接の質問に関する推奨事項: Java 面接の質問と回答 )
特に若手開発者にとって、面接ではフレームワーク関連の知識は問われない場合がありますが、ここでは、日常の開発や面接の準備に役立つ、一般的な SQL ステートメントのいくつかをまとめています。
基本的なテーブル構造:
student(sno,sname,sage,ssex)学生表 course(cno,cname,tno) 课程表 sc(sno,cno,score) 成绩表 teacher(tno,tname) 教师表
101、コース 1 の成績がコース 2 の成績よりも高いすべての生徒の生徒数をクエリします。
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、平均値をクエリします。 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」を学習した教師を確認してください すべてのコースの全生徒の生徒番号と名前は
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 の成績より高いすべての生徒の生徒番号。、Name
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、スコアが 60 点未満のすべての生徒の生徒 ID をクエリします。 name
select sno,sname from student where sno not in (select distinct sno from sc where score > 60)
110、学生 ID 1 を持つ少なくとも 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 入門チュートリアル
以上がJava で頻繁に聞かれる基本的な面接の質問—(9)の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









Java の乱数ジェネレーターのガイド。ここでは、Java の関数について例を挙げて説明し、2 つの異なるジェネレーターについて例を挙げて説明します。

Java の Weka へのガイド。ここでは、weka java の概要、使い方、プラットフォームの種類、利点について例を交えて説明します。

この記事では、Java Spring の面接で最もよく聞かれる質問とその詳細な回答をまとめました。面接を突破できるように。

Java 8は、Stream APIを導入し、データ収集を処理する強力で表現力のある方法を提供します。ただし、ストリームを使用する際の一般的な質問は次のとおりです。 従来のループにより、早期の中断やリターンが可能になりますが、StreamのForeachメソッドはこの方法を直接サポートしていません。この記事では、理由を説明し、ストリーム処理システムに早期終了を実装するための代替方法を調査します。 さらに読み取り:JavaストリームAPIの改善 ストリームを理解してください Foreachメソッドは、ストリーム内の各要素で1つの操作を実行する端末操作です。その設計意図はです

Java での日付までのタイムスタンプに関するガイド。ここでは、Java でタイムスタンプを日付に変換する方法とその概要について、例とともに説明します。

カプセルは3次元の幾何学的図形で、両端にシリンダーと半球で構成されています。カプセルの体積は、シリンダーの体積と両端に半球の体積を追加することで計算できます。このチュートリアルでは、さまざまな方法を使用して、Javaの特定のカプセルの体積を計算する方法について説明します。 カプセルボリュームフォーミュラ カプセルボリュームの式は次のとおりです。 カプセル体積=円筒形の体積2つの半球体積 で、 R:半球の半径。 H:シリンダーの高さ(半球を除く)。 例1 入力 RADIUS = 5ユニット 高さ= 10単位 出力 ボリューム= 1570.8立方ユニット 説明する 式を使用してボリュームを計算します。 ボリューム=π×R2×H(4
