PHP Learning practiced Hand (Fri)

Source: Internet
Author: User
Basic exercises for MySQL database

  1. Create a database

  2. Working with databases

  3. Create a table
    • Char: fixed-length constant
    • VARCHAR: variable

  4. Show Table

  5. View table Structure

  6. Inserting data
    SHA1 (): Encrypt data function, create an encrypted word a, which is exactly 40 characters long

  7. View all elements

  8. WHERE Condition Statement

  9. Between ...

  10. Like/not like

    • Wildcard _: matches a single character;%: matches 0 or more characters
    • Precede the wildcard with (\), then _ or% is only the original symbol and does not have a wildcard meaning.
    • Queries with like conditional statements are generally slow because the index cannot be used, so this format should be used only when absolutely necessary

  11. Sort order BY ascending ASC Descending desc

    • To sort the columns that are enum types, sorting is based on the order in which the enum values are created by the column.

  12. Limit

    • LIMIT x: Returns the first X record in the query record
    • LIMIT x, y: Returns the Y record starting with the X record
    • The limit clause does not improve the execution speed of the query because MySQL still has to assemble each record together, and then truncate the list

  13. Update, delete
    • To prevent yourself from accidentally updating too many rows, you can apply a limit clause to update
    • Clears a table, preferring truncate:truncate table tablename
    • To delete all the data in the table and the table itself: Drop table tablename;
    • To delete an entire database: Drop DB databasename

  14. Concat connection function

  15. CONCAT_WS Connection function

  16. Length function

  17. Format function

  18. Concat in combination with the Format function

  19. Rand () function

  20. Now (), Curtime (), curdate () function

  21. Date_format function

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the PHP learning practiced hand (v), including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.