How to Put a Query in MySQL and DB2

When you issue commands to either a MySQL database or a DB2 database, you use SQL, the standard programming language for doing this. Whenever you want to do something with a database, therefore, you need to understand the SQL syntax. Each query you enter follows this basic syntax.

Instructions

    • 1

      Use a 'select' query to gather information from the database. In the following example, the SQL query selects all the data from the 'people' table:

      SELECT * FROM people

    • 2

      Replace the * with the name of a column in the database to select only certain data. For example, to query only the 'name' column in the 'people' table:

      SELECT name FROM people

    • 3

      Select multiple columns of data by separating the column names by comma. To select 'name' and 'age', for example:

      SELECT name,age FROM people

      This is the basic select query to gather information from a MySQL or a DB2 database.

Related Searches:

References

Comments

Related Ads

Featured