Single-row inserts

To insert a single row into a table in MySQL, use the following syntax:

INSERT INTO lahmansbaseballdb.collegeplaying (`playerID`, `schoolID`, `yearID`) VALUES (<{playerID: }>, <{schoolID: }>, <{yearID: }>);

You can get this syntax by taking the following steps:

  1. Right-click on Tables in MySQL Workbench.
  2. Select Send to SQL Editor.
  3. Choose Insert Statement.

This places the INSERT syntax for that table into a SQL query window:

The INSERT statement allows you to add values to the collegeplaying table. To make the query insert proper values into a row in the collegeplaying table, you need to add values to the VALUES statement, ...

Get Learn SQL Database Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.