Executing multiple SQL statements
Observe the table
students. Let’s say we want to add multiple rows of records to it. Let’s see if multiple
INSERT statements can work together.
We get a syntax error. That’s because when we execute a single statement it works fine. But when we execute multiple statements, we need a separator between each of them. In SQL, a semi-colon (
;) serves that purpose. Run the set of statements below:
SQL, ideally each statement/query should be followed by a semi-colon. But we can do without it in a single statement/query. But it becomes important when dealing with multiple statements.