Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/faisalsaifii/mysql-tutorial
https://github.com/faisalsaifii/mysql-tutorial
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/faisalsaifii/mysql-tutorial
- Owner: faisalsaifii
- Created: 2022-07-23T09:49:21.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-12-15T10:53:55.000Z (about 2 years ago)
- Last Synced: 2024-11-05T21:17:53.343Z (2 months ago)
- Size: 1.95 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MySQL Documentation
## Creating a database
```sql
CREATE DATABASE [IF NOT EXISTS] database_name;
```## Using a Database
```sql
USE database_name;
```## Permanently Delete (Drop) a Database
```sql
DROP DATABASE [IF EXISTS] database_name;
```## Show all databases
```sql
SHOW DATABASE;
```## Show all tables
```sql
SHOW TABLES;
```## Create new table
```sql
CREATE TABLE [IF NOT EXISTS] table_name(
column_list
);
```## Selecting or Querying Fields
```sql
SELECT field_name
```## Query Distinct Elements
```sql
select distinct field_name
```## Specifying Table
```sql
from table_name
```## Conditioning
```sql
where
```## Arithmetics
- Modulus : `mod(Dividend, Divisor)`
- Finding Even Number : `mod(Dividend, Divisor) = 0`
- Finding Odd Number : `mod(Dividend, Divisor) <> 0`## Regular Expression
- Pattern Matching Operation
- Syntax : `regexp 'a'`
- [Reference](https://www.geeksforgeeks.org/mysql-regular-expressions-regexp/)| Pattern | Description |
| ----------- | ----------- |
|* | Zero or more instances of string preceding it |
|+ | One or more instances of strings preceding it|
|. | Any single character|
|? |Match zero or one instances of the strings preceding it.|
|^ |caret(^) matches Beginning of string|
|$ |End of string|
|[abc] | Any character listed between the square brackets|
|[^abc]| Any character not listed between the square brackets|
|[A-Z] |match any upper case letter.|
|[a-z] |match any lower case letter|
|[0-9] |match any digit from 0 through to 9.|
|[[:<:]] |matches the beginning of words.|
|[[:>:]] |matches the end of words.|
|[:class:] |matches a character class i.e. [:alpha:] to match letters, [:space:] to match white space, [:punct:] is match punctuations and [:upper:] for upper class letters|
|{n} |n instances of preceding element|
|{m,n} |m through n instances of preceding element|
| p1(bar)p2(bar)p3 | Alternation; matches any of the patterns p1, p2, or p3|## Exit
`exit;`