Page 139 - CodePilot V5.0 C8
P. 139

For example, to find the StudentID and FirstName where Age is 16 and FirstName is ‘Saanvi’, use
                 the following SELECT command:















                                                            Ask
                                                                      AGENT
                                                       OrangeAI
                  Create a Students table in the school database with the fields ID, Name, Class, Percentage and City.
                  Then, find the students who have a percentage above 80.


                          Study




                        UPDATING RECORDS IN A TABLE


                 To modify  existing  records in a table,  use  the UPDATE command.  The basic  syntax  for  the
                 UPDATE command is as follows:

                 UPDATE table_name SET Column = value WHERE condition;
                 To change the LastName and Address of the student having 32 as StudentID, use the following
                 command:













                        DELETING RECORDS FROM A TABLE


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

                     Without WHERE clause               With the WHERE clause
                 A specific  record can be  removed  using  the  WHERE clause  with the  DELETE command.  If  the

                 DELETE command is used without the WHERE clause, all the records in the table will be removed.
                 Here is the command to remove the record of a student whose FirstName is Dev:











                                                                                                                  137
                                                                                          MySQL: My First Database
   134   135   136   137   138   139   140   141   142   143   144