• Administration
  • Spanish Classes
  • Society.
  • Culture.
  • English
    • Arabic
    • Bulgarian
    • Croatian
    • Czech
    • Danish
    • Dutch
    • English
    • Estonian
    • Finnish
    • French
    • Georgian
    • German
    • Greek
    • Hebrew
    • Hindi
    • Hungarian
    • Indonesian
    • Italian
    • Japanese
    • Korean
    • Latvian
    • Lithuanian
    • Norwegian
    • Persian
    • Polish
    • Portuguese
    • Romanian
    • Russian
    • Serbian
    • Slovak
    • Slovenian
    • Swedish
    • Thai
    • Turkish
    • Ukrainian
  • Twitter
  • Facebook
  • Instagram
  • MySQL Queries Example
    • Science.
    • Get To Know Us
    • Psychology. Top Definitions
    • History. Top Definitions

    MySQL Queries Example

    Mysql   /   by admin   /   July 04, 2021

    Here I leave you some Example of common MySQL queries for all kinds, delete, add, review, etc.

    In these example We will use the name "table" as if it were the name of our table for the examples.

    To display the logs for:

    • SELECT * FROM table [Show all database results]
    • SELECT id, first name, last name FROM table [Shows all database results but only the id, first and last columns]
    • SELECT * FROM table WHERE id = '1' [Show the results that have the column with id 1]
    • SELECT * FROM table WHERE country = 'Italy' ORDER by id ASC [Shows the results that have the country column with Italy value, sorting it by the id column in ascending mode]
    • SELECT * FROM table ORDER by id DESC LIMIT 10 [Show the database results in descending order by id column limiting it to only 10 results]
    • SELECT * FROM table ORDER by RAND () [Show database results in random order]

    To add records:

    • INSERT into table (first name, last name, country, language) VALUES ('Monkey', 'Luffy', 'Italy', 'IT') [Add a record with name: Monkey, last name: Luffy, country: Italy, language: Italian IT]
    • instagram story viewer
    • INSERT into table (id, name) VALUES (NULL, '$ _POST [name]') [Add in the database a record with id NULL, that is, it would be automatic or empty depending on the structure of the column, and with the name taken from a form field in PHP]

    To edit records:

    • UPDATE table SET first name = 'Mauricio', last name = 'Mono', country = 'Mexico', language = 'ES' WHERE id = '1' [Modify the record with ID 1 with the values ​​name: Mauricio, last name: Mono, country: Mexico, language: ES de español]
    • UPDATE table SET Language = 'EN' WHERE surname = 'Mono' AND first name = 'Mauricio' [Change the language to EN of English where the name is Mauricio and the last name is Mono]

    To delete records:

    • DELETE FROM table WHERE id = '1' [We delete the record]
    • DELETE FROM table WHERE name = 'Mauricio' [We delete all the records that have Mauricio's name]

    To empty a table:

    • TRUNCATE TABLE table [Empty all the records in the table]
    Tags cloud
    • Mysql
    Rating
    0
    Views
    0
    Comments
    Recommend to friends
    • Twitter
    • Facebook
    • Instagram
    SUBSCRIBE
    Subscribe to comments
    YOU MIGHT ALSO LIKE
    • Concept in Definition ABC
      Miscellanea
      04/07/2021
      Concept in Definition ABC
    • Definition of Political Position
      Miscellanea
      04/07/2021
      Definition of Political Position
    • Definition of Accounting Close
      Miscellanea
      04/07/2021
      Definition of Accounting Close
    Social
    7320 Fans
    Like
    4923 Followers
    Follow
    8835 Subscribers
    Subscribers
    Categories
    Administration
    Spanish Classes
    Society.
    Culture.
    Science.
    Get To Know Us
    Psychology. Top Definitions
    History. Top Definitions
    Examples
    Kitchen
    Basic Knowledge
    Accounting
    Contracts
    Css
    Culture And Society
    Curriculum Vitae
    Right
    Design
    Art
    Job
    Polls
    Essays
    Writings
    Philosophy
    Finance
    Physics
    Geography
    Story
    Mexico History
    Asp
    Popular posts
    Concept in Definition ABC
    Concept in Definition ABC
    Miscellanea
    04/07/2021
    Definition of Political Position
    Definition of Political Position
    Miscellanea
    04/07/2021
    Definition of Accounting Close
    Definition of Accounting Close
    Miscellanea
    04/07/2021

    Tags

    • Basic Knowledge
    • Accounting
    • Contracts
    • Css
    • Culture And Society
    • Curriculum Vitae
    • Right
    • Design
    • Art
    • Job
    • Polls
    • Essays
    • Writings
    • Philosophy
    • Finance
    • Physics
    • Geography
    • Story
    • Mexico History
    • Asp
    • Administration
    • Spanish Classes
    • Society.
    • Culture.
    • Science.
    • Get To Know Us
    • Psychology. Top Definitions
    • History. Top Definitions
    • Examples
    • Kitchen
    Privacy

    © Copyright 2025 by Educational resource. All Rights Reserved.