Week5_All (1).pptx - Data Definition Language SQL Syntax SQL The standard programming language for creating updating and retrieving information that is

Week5_All (1).pptx - Data Definition Language SQL Syntax...

This preview shows page 1 - 12 out of 77 pages.

Data Definition Language
Image of page 1
SQL Syntax
Image of page 2
SQL The standard programming language for creating, updating and retrieving information that is stored in databases It is: A programming language – a formal language in which to write programs to create, modify, and query databases. Defined by rules of syntax (determine the words and symbols you can use and how they are combined)
Image of page 3
SQL It is declarative – you describe what you want and the database will determine how to do it It is interactive – you issue SQL commands directly to you Database Management System (Access, SQL Server, MySQL, etc) and it displays the results OR it is embedded – you can embed the SQL statements in a scripting language (PHP)
Image of page 4
SQL It is standardized – no one owns it, but it is a standard that is defined by an international standards working group. It is commonly referred to as S tructured Q uery L anguage – but that is incorrect. It actually stands for just SQL
Image of page 5
Syntax Conventions Each SQL statement begins on a new line The indentation level is two spaces Each clause begins on a new, indented line SQL is case insensitive, myname, MyName, and MYNAME are considered to be identical identifiers Generally use uppercase for SQL keywords and lowercase for user-defined values. SELECT au_fname, au_lname FROM authors ORDER BY au_lname You WILL follow these conventions
Image of page 6
SQL Syntax Comment – text that explains your program SQL statement – a valid combination of tokens introduced by a keyword. Tokens – the indivisible particles of the SQL language. They include keywords, identifiers, operators, literals (constants) and punctuation symbols Clauses – a fragment of an SQL statement that’s introduced by a keyword, is required or optional and must be given in a particular order. (SELECT, FROM , WHERE and ORDER BY introduce the four clauses in the example)
Image of page 7
SQL Syntax Keywords – words that SQL reserves because they have special meaning in the language. SELECT, CREATE, TABLE Identifiers – words that you use to name objects, columns, aliases, indexes and views authors, titles, books, Terminating semicolon – ends with an SQL statement (ACCESS and SQL server do not require)
Image of page 8
SQL Syntax Example of SQL Syntax --Retrieve authors from New York SELECT au_fname, au_lname FROM authors WHERE state = ‘NY’ ORDER BY au_lname; Comment SQL Statement Keywords Identifier Clauses
Image of page 9
SQL Syntax Comment – text that explains your program SQL statement – a valid combination of tokens introduced by a keyword. Tokens – the indivisible particles of the SQL language. They include keywords, identifiers, operators, literals (constants) and punctuation symbols Clauses – a fragment of an SQL statement that’s introduced by a keyword, is required or optional and must b given in a particular order. (SELECT, FROM , WHERE and ORDER BY introduce the four clauses in the example)
Image of page 10
SQL Syntax Keywords – words that SQL reserves because they have special meaning in the language.
Image of page 11
Image of page 12

You've reached the end of your free preview.

Want to read all 77 pages?

  • Fall '14

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors