SQL:Backus-Naur Form

From virtualMV2015wiki
Jump to: navigation, search
 Home  MySQL <

Introduction

Overview

  • How can we describe the commands?
    • A notation was devised in 1959 by John Backus (IBM) to describe a programming language called Algol 58, and in 1960 Peter Naur, a Danish programmer refined it.
    • This notation is used to concisely define SQL (and other languages)
  • For example
CREATE TABLE table_name
 (column_name datatype [NULL | NOT NULL] [,
  column_name datatype [NULL | NOT NULL] ]...)


Icon Objective.png

Objective

By the end of this page you should be able to:

  • Understand that SQL can be described using the Backus-Naur Form

Backus-Naur Form

  • Briefly
Symbol   means Example
( ) (brackets) you must use brackets  
| (vertical bar) "one of"  
, (comma) "none, one or more than one"  
... (3 dots) you can repeat the previous item as often as you want  
< > (angle brackets) replace the contents with the actual item name

SELECT * FROM <tablename> could be
SELECT * FROM tblStudents;

Sometimes the < and > are omitted.
{ } (braces) you "must choose one of".  {a|b|c} = choose one of a or b or c.
{a,b,c} = choose one or many of a,b, and c)
[ ] (brackets) you may choose one of  [a|b|c] you may choose a or b or c


Icon References.png References


SQL:Backus-Naur Form. (2017). In virtualMV's ( Michael Verhaart ) wiki. Retrieved December 18, 2017, from http://www.virtualmv.com/wiki/index.php?title=SQL%3ABackus-Naur_Form    (zotero)