MySQL access through C #

Source: Internet
Author: User

1. MySQL does not use single quotes, but uses '(that is, the ~ in the upper left corner of the keyboard ~) , This is not a single quote'

2. Drop schema, drop Schema

3. Enumeration table

String myconstring = "Server = localhost;" +
"Database = information_schema;" +
"Uid = root;" +
"Password = password ;";

VaR strselect = @ "select * From information_schema.tables where left (table_schema, 6) = 'galaxy '";

4. String Pattern Matching, regular expression:

Select * From information_schema.tables where left (table_schema, 6) = 'galaxy'

Select * From information_schema.tables where table_schema Regexp 'galaxy _ ks_v6_s _ [[: digit:] +'

To find"W"Name:

mysql> SELECT * FROM pet WHERE name LIKE '%w%';
+----------+-------+---------+------+------------+------------+
| name     | owner | species | sex  | birth      | death      |
+----------+-------+---------+------+------------+------------+
| Claws    | Gwen  | cat     | m    | 1994-03-17 | NULL       |
| Bowser   | Diane | dog     | m    | 1989-08-31 | 1995-07-29 |
| Whistler | Gwen  | bird    | NULL | 1997-12-09 | NULL       |
+----------+-------+---------+------+------------+------------+

To find a name that exactly contains five characters, use"_"Mode character:

mysql> SELECT * FROM pet WHERE name LIKE '_____';
+-------+--------+---------+------+------------+-------+
| name  | owner  | species | sex  | birth      | death |
+-------+--------+---------+------+------------+-------+
| Claws | Gwen   | cat     | m    | 1994-03-17 | NULL  |
| Buffy | Harold | dog     | f    | 1989-05-13 | NULL  |
+-------+--------+---------+------+------------+-------+

Regular Expression: http://dev.mysql.com/doc/refman/5.1/zh/regexp.html

Pattern Match: http://dev.mysql.com/doc/refman/5.1/zh/tutorial.html#pattern-matching

5. enumerate databasename

Select 'schema _ name' from 'information _ scheme'. 'schema'

Related Article

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.