Page 300 - Trackpad 402_Class-X_Final
P. 300
+--------+---------------+------+------------+-------+----------+
| RollNo | Name | Fees | DOB | Marks | ClassSec |
+--------+---------------+------+------------+-------+----------+
| 14 | Jaya Kapoor | 7800 | 2008-03-08 | 78 | 11C |
| 35 | Sikha Arora | 8800 | 2004-12-15 | 87 | 9D |
| 8 | Aparna Aneja | 9000 | 2006-09-24 | 92 | 10A |
| 12 | Debrath Singh | 8600 | 2010-10-27 | 92 | 10A |
+--------+---------------+------+------------+-------+----------+
To display Name and fees of the student with increased fees by Rs 250.
SELECT NAME, FEES+250 FROM STUDENT;
+---------------+----------+
| NAME | FEES+250 |
+---------------+----------+
| Jaya Kapoor | 8050 |
| Sikha Arora | 9050 |
| Aparna Aneja | 9250 |
| Debrath Singh | 8850 |
+---------------+----------+
Using like operator
Like operator is used with WHERE clause to search for a specific pattern in a column.
It can be used with two wildcard characters:
• The percent sign (%) represents zero, one, or more characters
• The underscore sign (_) represents one character
To display rollno, name and fees of those students whose names end with ‘a’.
SELECT ROLLNO,NAME,FEES FROM STUDENT WHERE NAME LIKE '%a';
+--------+--------------+------+
| ROLLNO | NAME | FEES |
+--------+--------------+------+
| 35 | Sikha Arora | 8800 |
| 8 | Aparna Aneja | 9000 |
+--------+--------------+------+
To display records of those students whose names start with ‘A’.
SELECT * FROM STUDENT WHERE NAME LIKE “A%”;
+--------+--------------+------+------------+-------+----------+
| RollNo | Name | Fees | DOB | Marks | ClassSec |
+--------+--------------+------+------------+-------+----------+
| 8 | Aparna Aneja | 9000 | 2006-09-24 | 92 | 10A |
+--------+--------------+------+------------+-------+----------+
300 Trackpad Information Technology-X

