Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you read sqlite3 diagrams / flowcharts?

Can someone explain, by example, how to read sqlite flowcharts and diagrams on the sqlite website?

For example, a diagram like:

sqlite diagram

How do I read this - and what does it mean?

like image 287
CodyBugstein Avatar asked Feb 14 '23 05:02

CodyBugstein


1 Answers

The flowchart above gives you the valid ways to write a select statement. Just follow the arrow and you can see what you can do.

Reading this, you can see that you must start at SELECT. Then you can either go straight to the result-column or put in either DISTINT or ALL (but not both, because there is no way to follow the arrows and put them both in).

Once you get to the result-column, you can continue, or put a comma and another result-column. You can loop there as many times as you want.

From there you can go all the way to the end, or put in any of the FROM, WHERE or GROUP BY clauses (but they have to go in that order if they are there). The GROUP BY clause can have an optional HAVING clause.

In the end, it is just a flow chart. Follow the arrows. This diagram doesn't explain what this stuff does however, it only explains what makes a legal statement.

like image 89
Damien Black Avatar answered Feb 16 '23 18:02

Damien Black