SQL Fundamentals · Getting started
18 cards
A SQL Workflow from Connection to Result
-
Quick check
You want to start practising SQL, but you have never installed or configured a database server. Which statement is accurate?
AAn administrator may already have created the database you need
Right. Access is often provisioned for you, so learning SQL does not have to begin with server administration.
BEvery SQL user must first stop the running PostgreSQL server
Stopping the server would remove the very thing that accepts connections and performs the work.
CConnecting to one database turns all the other databases into tables
A database is not converted into a table by a connection; the hierarchy is unchanged by connecting.
3 / 18
-
Quick check
In the tutorial workflow, what does the command psql mydb do?
AIt creates a new table named psql that has a column called mydb
Tables are created with a SQL statement, not by naming the client program on the command line.
BIt converts every database on the server into an interactive command
Databases are not turned into commands; the argument only says which database to work in.
CIt starts the psql terminal client connected to the database named mydb
Right. The argument names the database that the interactive terminal should access.
6 / 18
-
Quick check
You type a SELECT statement in psql, press Return, and nothing is sent. What is the most likely reason?
AThe client only accepts statements that were written in a graphical tool
psql is a text client that accepts typed SQL; it does not require another tool to write it.
BThe command has not been terminated, so the semicolon is still missing
Right. The command is sent only when it is complete, and the semicolon is what terminates it.
CThe database was closed by the server as soon as the prompt appeared
The prompt is the sign that the client is listening; it does not mean the database has been closed.
9 / 18
-
Keep your progress in the app
That’s 3 of 7 quick checks. In the app they stay answered, and every lesson remembers where you left off.
-
Quick check
How do psql's own internal commands differ from SQL sent to the server?
AThey are written as a table row rather than as a statement
A table row is stored data; it is not a way of typing a command at the prompt.
BThey begin with a backslash and are handled by the client
Right. The backslash prefix marks a command that psql handles itself instead of sending it as SQL.
CThey can only be typed after the connection has been closed
These commands are used during a session, at the same prompt where SQL is typed.
11 / 18
-
Quick check
A small project needs repeatable storage, a first set of records, and visible evidence that retrieval works. Which path meets all three needs?
ADefine the table, insert the records, then run a SELECT and read its result
Right. The table and the inserted rows create the stored state, and the query returns observable evidence.
BExit psql, drop the database, and treat the missing result as a success
Removing the database destroys the very state the project needs, and an absent result proves nothing.
CUse a backslash command as the table, then read its help text as stored rows
A backslash command is client help; it stores no data and returns no rows from the database.
14 / 18
-
Quick check
A graphical-frontend user gets an unexpected query result and must keep the stored data while refining the request. What comes next?
AReplace the graphical client with a table and treat the result as its data type
A client is a program and a table is stored data; neither can take the other's place in the session.
BRemove the PostgreSQL server and its databases because one result was wrong
One unsatisfactory result is a reason to revise the statement, not to destroy the managed state.
CInspect the result, revise the SQL, and send another complete command
Right. Send, inspect, revise, repeat is the loop, and it works from any client without discarding stored data.
16 / 18
-
Quick check
Which summary keeps the connection, the client, and the SQL in their right places?
AChoose the intended database, connect through a client, and end each statement so that the server can act on it
Right. The database is chosen, a client carries the request, and a completed command is what the server executes.
BOpen any client, and every typed line reaches the server as SQL at once
Backslash commands never reach the server, and an unterminated statement is not sent at all.
CStart with a backslash command as the query, and let the client store the returned rows
Backslash commands control the client rather than query data, and the database holds the stored rows.
18 / 18
-
7 quick checks · then the test
In the app, finishing the quick checks opens this lesson’s 10-question test, and the ones you miss come back exactly when you’re about to forget them.
The whole course, on your phone
Lessons you can read, audio you can listen to on the way to work, and practice that remembers what you got wrong.