|  | 
| 1 | 1 | export const ConnectionDocs = `# Connections Docs | 
| 2 | 2 | 
 | 
| 3 |  | -Use SQL to create live connections from your spreadsheets to your databases and data warehouses.  | 
| 4 |  | -
 | 
| 5 |  | -Once established, you have a live connection that can be rerun, refreshed, read from, and written to your SQL database.  | 
|  | 3 | +Use SQL to create connections from spreadsheets to databases and data warehouses.  | 
| 6 | 4 | 
 | 
| 7 | 5 | You can both read and write to your databases from Quadratic.  | 
| 8 | 6 | 
 | 
| 9 |  | -Once your connection has been made you can use your connection directly in the sheet. Open the code cell selection menu with \`/\` and select your database from the list. | 
| 10 |  | -
 | 
| 11 |  | -You can now query your database from your newly opened SQL code editor. You can view the schema or open the AI assistant in the bottom. | 
| 12 |  | -
 | 
| 13 |  | -The results of your SQL queries are returned to the sheet, with column 0, row 0 anchored to the cell location.  | 
| 14 |  | -
 | 
| 15 |  | -Query all data from a database table into the spreadsheet | 
| 16 |  | -
 | 
| 17 |  | -\`\`\`sql | 
| 18 |  | -SELECT * FROM table_name | 
| 19 |  | -\`\`\` | 
| 20 |  | -
 | 
| 21 |  | -Query a limited selection (100 rows) from a single table into the spreadsheet  | 
| 22 |  | -
 | 
| 23 |  | -\`\`\`sql | 
| 24 |  | -SELECT * FROM table_name  | 
| 25 |  | -LIMIT 100 | 
| 26 |  | -\`\`\` | 
| 27 |  | -
 | 
| 28 |  | -Query specific columns from a single table into the spreadsheet  | 
| 29 |  | -
 | 
| 30 |  | -\`\`\`sql | 
| 31 |  | -SELECT column_name1, column_name2  | 
| 32 |  | -FROM table_name  | 
| 33 |  | -LIMIT 100 | 
| 34 |  | -\`\`\` | 
| 35 |  | -
 | 
| 36 |  | -Query all unique values in a column  | 
| 37 |  | -
 | 
| 38 |  | -\`\`\`sql | 
| 39 |  | -SELECT DISTINCT column_name1  | 
| 40 |  | -FROM table_name  | 
| 41 |  | -LIMIT 100 | 
| 42 |  | -\`\`\`  | 
| 43 |  | -
 | 
| 44 |  | -Query data conditionally | 
| 45 |  | -
 | 
| 46 |  | -\`\`\`sql | 
| 47 |  | --- selects 3 specific columns from a table where column1 equals some value | 
| 48 |  | -SELECT column1, column2, column3 | 
| 49 |  | -FROM table_name | 
| 50 |  | -WHERE column1 = 'some_value'; | 
| 51 |  | -\`\`\` | 
| 52 |  | -
 | 
| 53 |  | -\`\`\`sql | 
| 54 |  | --- selects 3 specific columns from a table where column1 equals some value and column2 equals some value  | 
| 55 |  | -SELECT column1, column2, column3 | 
| 56 |  | -FROM table_name | 
| 57 |  | -WHERE column1 = 'some_value' AND column2 = 5; | 
| 58 |  | -\`\`\` | 
|  | 7 | +IMPORTANT: DO NOT under any circumstances perform SQL queries that write to the database unless a user asks for it; only perform reads by default. | 
| 59 | 8 | 
 | 
| 60 | 9 | You cannot do two queries at once in SQL in Quadratic. For example, you can not create a table and then query that table in the same SQL query. You'll want to generate two distinct code blocks if two queries are involved. Or 3 code blocks if three queries are involved, etc. | 
| 61 | 10 | 
 | 
|  | 
0 commit comments