<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://sqle.ru/index.php?action=history&amp;feed=atom&amp;title=SQL%2FMySQL%2FSelect_Clause%2FExists</id>
		<title>SQL/MySQL/Select Clause/Exists - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://sqle.ru/index.php?action=history&amp;feed=atom&amp;title=SQL%2FMySQL%2FSelect_Clause%2FExists"/>
		<link rel="alternate" type="text/html" href="http://sqle.ru/index.php?title=SQL/MySQL/Select_Clause/Exists&amp;action=history"/>
		<updated>2026-07-15T21:39:11Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://sqle.ru/index.php?title=SQL/MySQL/Select_Clause/Exists&amp;diff=5292&amp;oldid=prev</id>
		<title> в 13:46, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://sqle.ru/index.php?title=SQL/MySQL/Select_Clause/Exists&amp;diff=5292&amp;oldid=prev"/>
				<updated>2010-05-26T13:46:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 13:46, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://sqle.ru/index.php?title=SQL/MySQL/Select_Clause/Exists&amp;diff=5293&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://sqle.ru/index.php?title=SQL/MySQL/Select_Clause/Exists&amp;diff=5293&amp;oldid=prev"/>
				<updated>2010-05-26T10:16:46Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Subquery: Using EXIST Operator==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
mysql&amp;gt; SELECT StudentID, Name FROM Student s&lt;br /&gt;
    -&amp;gt; WHERE EXISTS (&lt;br /&gt;
    -&amp;gt;    SELECT StudentID FROM StudentExam e&lt;br /&gt;
    -&amp;gt;    WHERE Mark &amp;lt; 40 AND e.StudentID = s.StudentID);&lt;br /&gt;
+-----------+----------+&lt;br /&gt;
| StudentID | Name     |&lt;br /&gt;
+-----------+----------+&lt;br /&gt;
|         2 | Henry Al |&lt;br /&gt;
|         5 | Sam Jun  |&lt;br /&gt;
+-----------+----------+&lt;br /&gt;
2 rows in set (0.02 sec)&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
Drop table Student;&lt;br /&gt;
Drop table StudentExam;&lt;br /&gt;
Drop table Exam;&lt;br /&gt;
CREATE TABLE Student (&lt;br /&gt;
   StudentID INT NOT NULL PRIMARY KEY,&lt;br /&gt;
   Name      VARCHAR(50) NOT NULL&lt;br /&gt;
)TYPE = InnoDB;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE StudentExam (&lt;br /&gt;
   StudentID  INT NOT NULL,&lt;br /&gt;
   ExamID     INT NOT NULL,&lt;br /&gt;
   Mark       INT,&lt;br /&gt;
   IfPassed   SMALLINT,&lt;br /&gt;
   Comments   VARCHAR(255)&lt;br /&gt;
)TYPE = InnoDB;&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE Exam (&lt;br /&gt;
   ExamID      INT NOT NULL PRIMARY KEY,&lt;br /&gt;
   CourseID    INT NOT NULL,&lt;br /&gt;
   ProfessorID INT NOT NULL,&lt;br /&gt;
   SustainedOn DATE,&lt;br /&gt;
   Comments    VARCHAR(255),&lt;br /&gt;
   INDEX       examcourse_index(CourseID),&lt;br /&gt;
   CONSTRAINT  FK_ExamCourse FOREIGN KEY (CourseID)&lt;br /&gt;
               REFERENCES Course(CourseID),&lt;br /&gt;
   INDEX       examprof_index(ProfessorID),&lt;br /&gt;
   CONSTRAINT  FK_ExamProf FOREIGN KEY (ProfessorID)&lt;br /&gt;
               REFERENCES Professor(ProfessorID)&lt;br /&gt;
)TYPE = InnoDB;&lt;br /&gt;
&lt;br /&gt;
INSERT INTO Student (StudentID,Name) VALUES (1,&amp;quot;Joe Wang&amp;quot;);&lt;br /&gt;
INSERT INTO Student (StudentID,Name) VALUES (2,&amp;quot;Henry Al&amp;quot;);&lt;br /&gt;
INSERT INTO Student (StudentID,Name) VALUES (3,&amp;quot;Amma Zee&amp;quot;);&lt;br /&gt;
INSERT INTO Student (StudentID,Name) VALUES (4,&amp;quot;Lili Lee&amp;quot;);&lt;br /&gt;
INSERT INTO Student (StudentID,Name) VALUES (5,&amp;quot;Sam Jun&amp;quot;);&lt;br /&gt;
INSERT INTO Student (StudentID,Name) VALUES (6,&amp;quot;Dianna Wang&amp;quot;);&lt;br /&gt;
INSERT INTO Exam (ExamID,CourseID,ProfessorID,SustainedOn,Comments) VALUES (1,1,1,&amp;quot;2003-03-12&amp;quot;,&amp;quot;A difficult test that should last an hour&amp;quot;);&lt;br /&gt;
INSERT INTO Exam (ExamID,CourseID,ProfessorID,SustainedOn,Comments) VALUES (2,2,1,&amp;quot;2003-03-13&amp;quot;,&amp;quot;A simple two hour test&amp;quot;);&lt;br /&gt;
INSERT INTO Exam (ExamID,CourseID,ProfessorID,SustainedOn,Comments) VALUES (3,3,2,&amp;quot;2003-03-11&amp;quot;,&amp;quot;1 hour long&amp;quot;);&lt;br /&gt;
INSERT INTO Exam (ExamID,CourseID,ProfessorID,SustainedOn) VALUES (4,4,3,&amp;quot;2003-03-18&amp;quot;);&lt;br /&gt;
INSERT INTO Exam (ExamID,CourseID,ProfessorID,SustainedOn,Comments) VALUES (5,5,2,&amp;quot;2003-03-19&amp;quot;,&amp;quot;2 hours long&amp;quot;);&lt;br /&gt;
INSERT INTO Exam (ExamID,CourseID,ProfessorID,SustainedOn) VALUES (6,6,3,&amp;quot;2003-03-25&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (1,1,55,1,&amp;quot;Satisfactory&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (1,2,73,1,&amp;quot;Good result&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (2,3,44,1,&amp;quot;Scraped through&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (2,5,39,0,&amp;quot;Failed, and will need to retake this one later in the year&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed) VALUES (2,6,63,1);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (3,4,78,1,&amp;quot;Excellent result&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (3,7,82,1,&amp;quot;Great result!&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (4,8,65,1,&amp;quot;Adequate performance&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (4,11,72,1,&amp;quot;Good result&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (4,5,53,1,&amp;quot;Below expectations&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (5,1,26,0,&amp;quot;Very poor performance. Recommend this student drop this module&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (5,9,68,1,&amp;quot;Good result&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (5,2,62,1,&amp;quot;Good result&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (6,3,78,1,&amp;quot;Excellent work&amp;quot;);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed) VALUES (6,6,69,1);&lt;br /&gt;
INSERT INTO StudentExam (StudentID,ExamID,Mark,IfPassed,Comments) VALUES (6,10,58,1,&amp;quot;Adequate performance&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
SELECT StudentID, Name FROM Student s&lt;br /&gt;
WHERE EXISTS (&lt;br /&gt;
   SELECT StudentID FROM StudentExam e&lt;br /&gt;
   WHERE Mark &amp;lt; 40 AND e.StudentID = s.StudentID);&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>