Page 142 - Plus V4 with Adobe class 8
P. 142

We can also us the wildcards (* and %) with the SELECT command to specify conditions. The * wildcard
        denotes a single character, on the other hand the % wildcard denotes the multiple characters:

              SELECT FirstName, Marks FROM Student WHERE LastName like 'K%';

                                              +-----------+-------+
                                              | FirstName | Marks |
                                              +-----------+-------+
                                              | Divya     |   450 |
                                              | Aadarsh   |   450 |
                                              +-----------+-------+
              SELECT Marks FROM Student WHERE FirstName like 'A%';

                                                      +-------+
                                                      | Marks |
                                                      +-------+
                                                      |   450 |
                                                      +-------+


        UPDATING RECORDS IN A TABLE

        Sometime, you may need to change the detail inserted into a table. In that case, the UPDATE command
        will work. The syntax of the UPDATE command is:

            UPDATE table_name SET field_change=value WHERE field_criteria=value;
        Let us change the marks of the student  having  10002  as StudentID  from 480  to 485  by using  the
        following command:

            UPDATE Student SET Marks = 485 where StudentID = 10002;
                                +-----------+-----------+----------+-------+
                                | StudentID | FirstName | LastName | Marks |
                                +-----------+-----------+----------+-------+
                                |     10001 | Amit      | Sharma   |   450 |
                                |     10002 |  Divya    | Kaushik  |   485 |
                                |     10003 |  Aadarsh  | Kumar    |   450 |
                                +-----------+-----------+----------+-------+


        REMOVING RECORDS FROM A TABLE

        The DELETE command is used to remove records from a table. The DELETE command can be used in
        two ways:
            Without WHERE clause

            With the WHERE clause
        We can remove a specific record by using the WHERE clause with the DELETE command. If we use the
        DELETE command without the WHERE clause, it will remove all the records from a table. Let us use the
        DELETE command to remove the record of a student whose LastName is Kumar:


            DELETE FROM Student WHERE LastName="Kumar";
        To remove all the records, following command is used:


            DELETE FROM Student;



            140  Plus (Ver. 4.0)-VIII
   137   138   139   140   141   142   143   144   145   146   147