Basic MySQL Command Tutorial

Introduction: Basic MySQL Command Tutorial

About: Occupation: Tech Support

Basic MySQL Command Tutorial:

  1. SQL query using a pattern:
    Select * from '[table name]' where [field name] like '[text]%'
    The '%' sign is a wildcard; eg: Eliz%
  2. SQL query using exact words:
    Select * from '[table name]' where [field name] = '[text]'
    Eg: 'Elizabeth Smith'
  3. SQL query using pattern and 2 wildcards:
    Select * from '[table name]' where [field name] = '[text]%[text]%'
    Eg: 'Eliz%Sm%'
  4. SQL query using multiple exact words:
    Select * from '[table name]' where [field name] ='[search text]' or [field name] = '[search text]'
    EG: zip='10001' or zip='10002'
  5. This SQL command changes a field or fields in a table based on a pattern matching another field.
    The basic command is an UPDATE:
    UPDATE [table] SET [field1]='[new data]', [field2]='[new data]' WHERE [any field in database] = '[data]'
    An example:
    UPDATE representativetable SET title='Assemblyman', name='Rafael Espinal', WHERE district = 'A054'
    The above command looks for district A054 and changes the title and name fields.

Be the First to Share


    • "Can't Touch This" Family Contest

      "Can't Touch This" Family Contest
    • CNC Contest 2020

      CNC Contest 2020
    • Robots Contest

      Robots Contest