An open API service indexing awesome lists of open source software.

https://github.com/sanam2405/sql

Learning Structured Query Language
https://github.com/sanam2405/sql

sql

Last synced: 5 months ago
JSON representation

Learning Structured Query Language

Awesome Lists containing this project

README

          

# SQL
Learning Structured Query Language

## Methods

- Check if an expression returns NULL
```console
IFNULL(,)
```

- Limit the number of results printed on firing a given query
```console
LIMIT ,
```
- Find the difference between two dates
```console
DATEDIFF(,)
```

- Match a Regular Expression or REGEX
```console
LIKE
```

- Concatenate the results of a query into a single row
```console
GROUP_CONCAT()
```

- Find the unique or distinct values across all the rows of a column
```console
DISTINCT
```

- Group multiple similar rows of a particular column
```console
GROUP BY
```

- Order the output by ascending or descending order on firing a given query
```console
ORDER BY DESC
```

- Specify conditions to query rows from a table
```console
WHERE
```

- Specify conditions to query groups from a table, after GROUP BY has been applied
```console
HAVING
```

- Extract a substring. 1-based indexing is followed in MySQL
```console
SUBSTR(,,)
SUBSTR(,)
```

- Concatenate strings and varchars
```console
CONCAT(,)
```

- Change to upper case
```console
UPPER()
```

- Change to lower case
```console
LOWER()
```

- Check a value against multiple rows from a subquery
```console
IN()
```

- Switch-Case Statement
```console
CASE
WHEN THEN
WHEN THEN
ELSE
END
```

- If Statement
```console
IF(,,)
```

- Alter and Rename the Column name
```console
ALTER
RENAME COLUMN
```

- Update values in a Row, If the row is not present then nothing happens
```console
UPDATE
SET ,
WHERE
```

- Insert values in a Row
```console
INSERT INTO
(
,

)
VALUES
(
,
)
```

- Replace values in a Row, If the row is not present, then a new row is created. Replace = Insert+Update
```console
REPLACE INTO
(
,

)
VALUES
(
,
)
```

- Rename the Table
```console
ALTER TABLE
RENAME TO
```