Combining WHERE Conditions : Where : Where Clause SQL / MySQL


SQL / MySQL » Where Clause » Where »

 

Combining WHERE Conditions



/* Prepare the data */
CREATE TABLE Exam (
   StudentID  INT NOT NULL,
   ExamID     INT NOT NULL,
   Mark       INT,
   IfPassed   SMALLINT,
   Comments   VARCHAR(255)
   
)TYPE = InnoDB;
  
/* Insert data for testing */ 
INSERT INTO Exam (StudentID,ExamID,Mark,IfPassed,CommentsVALUES (1,1,55,1,'Java Test');
INSERT INTO Exam (StudentID,ExamID,Mark,IfPassed,CommentsVALUES (1,2,73,1,'C# Test');
INSERT INTO Exam (StudentID,ExamID,Mark,IfPassed,CommentsVALUES (2,3,44,1,'JavaScript Test');


/* Real command */
SELECT StudentID, Mark, Comments FROM Exam
WHERE ExamID = AND IfPassed = 1;

           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

SQL / MySQL

 Navioo Where Clause
» Where