This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT column1, column2, ... | |
| FROM table_name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT column_name(s) | |
| FROM table_name | |
| WHERE condition | |
| GROUP BY column_name(s) | |
| ORDER BY column_name(s); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT column_name | |
| FROM table_name # the main query | |
| WHERE column_name expression operator | |
| ( SELECT COLUMN_NAME from TABLE_NAME WHERE ... ) #the subquery; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH my_cte AS ( | |
| SELECT a,b,c | |
| FROM T1 | |
| ) | |
| SELECT a,c | |
| FROM my_cte | |
| WHERE .... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH my_cte AS ( | |
| SELECT column1, column2, column3 | |
| FROM table | |
| ) | |
| SELECT column1, column3 | |
| FROM my_cte | |
| WHERE condition ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT column_name(s) | |
| FROM table1 | |
| INNER JOIN table2 | |
| ON table1.column_name = table2.column_name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random, sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import modules | |
| import random, sys | |
| # start the game | |
| Print('ROCK, PAPER, SCISSORS') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wins = 0 | |
| losses = 0 | |
| ties = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while True: # The main game loop | |
| print('%s Wins, %s Losses, %s Ties' % (wins, losses, ties)) | |
| while True: # The player input loop. | |
| print('Enter your move: (r)ock (p)aper (s)cissors or (q)uit') | |
| playerMove = input() | |
| if playerMove == 'q': | |
| sys.exit() #Quit the program. | |
| if playerMove == 'r' or playerMove == 'p' or playerMove == 's': | |
| break # Break out of the player input loop. | |
| print('Type one of r, p, s, or q.') |
OlderNewer