A database is a named collection of tables. Today you build the registry that creates tables by name and hands them back, so queries can refer to a table by the name in the SQL.
Create tables by name in a database, fetch them back, and reject a duplicate name.
The database is the outermost object: a map from table name to table. When a
query says FROM users, the engine asks the database for the table named
"users". Creating a table registers a fresh, empty table under its name;
asking for one by name hands it back so rows can be inserted or scanned.
Two rules keep it honest. Creating a table whose name already exists is an error
CREATE TABLE and a query against a missing table
raise, and wiring them in now means the executor gets them for free later.type Database struct { tables map[string]*Table }func (db *Database) CreateTable(name string, s Schema) (*Table, error) {// error if name already exists, else store and return a new *Table}func (db *Database) Table(name string) (*Table, bool) { /* map lookup */ }