Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 138 - CodePilot V5.0 C8
P. 138

    The SELECT command can also retrieve specific
                      fields from a table by listing the column names
                      instead of using the asterisk (*).

                      For example, to  display  only  the  StudentID  and
                      FirstName from the Students table, use the given
                      command.

                                        If  a database is like  a treasure  chest  and you’re  the treasure  keeper,  how would
                                        you organise and store your precious items to make sure you can find them easily
                                        when needed?

                      THE WHERE CLAUSE

                      The SELECT command supports several optional clauses to refine your results. The WHERE clause
                      is one of the most useful, as it filters records based on specified conditions.
                      The syntax of the WHERE clause is as follows:

                      SELECT * FROM  table_name WHERE condition;
                      For example, to retrieve the records of all students with the last name ‘Sharma’, use the following
                      SELECT command:

                      For example, to find students older than 15 and show their StudentID, FirstName, and Age, use the
                      following SELECT command:

                      In SQL, you can retrieve data based on multiple conditions by using the AND and OR operators.
                      These operators allow you to combine more than one condition through the WHERE clause.

                       136
                            CodePilot (V5.0)-VIII

| 133 134 135 136 137 138 139 140 141 142 143 |