• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Week: 3 At a Glance > Answers for Day 12, “Writing Advanced Database Queries”

Answers for Day 12, “Writing Advanced Database Queries”

1: How do you create a database within SQL?
A1: Use the database create command.
2: Why is the phrase “insert data into the database” syntactically wrong?
A2: Although I probably use the same phrase in several places of the book, it isn't entirely correct. A database is the wrapper for one or more tables, views, and so on. These internal structures hold the actual records and are the object of the insert command.
3: What does * do in a select statement?
A3: Selects all the fields, rather than a named subset.
4: How can you refer to a specific field name within a specific table?
A4: Use the format "<table name>.<field name>". Although it is possible to use just the field name in many cases, this leads to ambiguities when dealing with multiple tables with identical names.
5: What happens if you do not supply a WHERE clause when selecting records?
A5: If a query, delete, and so on receives an empty search expression, it will select all the records in the database. This can be a bit distressing for a first-time SQL author who guesses (incorrectly) that an empty search expression would match zero records.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint