XII CS : 19-10-2020 (By D.
Kumar)
Topic : SQLCommands
SQL > Select *from student;
SQL> select name, gender from student;
SQL > select *from student where rollno<=8;
SQL>select Name,rollno, dob, marks from student;
SQL> select stream from student;
Sql>select distinct stream from student;
SQL Operators
Arithmetic
Relational
Logical
Special
SQL> select 5+10;
15
Or
SQL >select 5+10 from DUAL;
15
SQL> select 5*4 from DAUL;
20
Sql> SELECT 47%5 FROM DUAL;
2
Sql> SELECT rollno, name, marks from student
Where marks>=90;
SQL>select *from student
Where stream <>'Commerce'
SQL> select *from student where marks>80 and Gender='M';
SQL> select RollNo, Name, Stream, from student
Where stream='science' or stream='commerce'
SQL>select name,marks from student
Where Not(stream='vocational');
SQL Aliases
SQL> select Name as "Student_name", DOB as "Date of Birth" from student;
SQL>select rollno, name, 'was born on', DOB from student;
SQL> select rollno, name, marks from student
Where marks between 80 and 100;
SQL> select rollno, name, marks from student
Where marks NOT between 80 and 100;
SQL> select *from student where stream IN('Science', 'Commerce','Humanities');
SQL> select *from student where stream NOT IN('Science',
'Commerce','Humanities');
Conditionals Based on Pattern –
(Wildcard Character)
Percentage : % (Matches any string) : Windows OS - *
Underscore : _ (Matches any one character) : Windows OS - ?
SQL>select *from student where name LIKE "D%";
SQL>select *from student where name LIKE " %a";
SQL>select *from student where name LIKE " %e%";
SQL>select *from student where name LIKE " _e%";
SQL>select *from student where name LIKE " %r_ _";