GoodSQLIntro

GoodSQLIntro - How to Use MySQL CS430 SQL"Structured Query...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
How to Use MySQL CS430 March 18, 2003
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
SQL: “Structured Query Language”—the most common standardized language used to access databases. SQL has several parts: DDL – Data Definition Language {Defining, Deleting, Modifying relation schemas} DML – Data Manipulation Language {Inserting, Deleting, Modifying tuples in database} Embedded SQL – defines how SQL statements can be used with general-purposed programming
Background image of page 2
MySQL, the most popular Open Source SQL database, is developed, distributed and supported by MySQL AB. MySQL is a relational database management system. MySQL software is Open Source. Written in C and C++. Tested with a broad range of different compilers. Works on many different platforms. APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and Tcl. You can find MySQl manual and documentation at: http://www.mysql.com/documentation/
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MySQL To see a list of options provided by mysql, invoke it with the --help option: shell> mysql --help Using SQL: On any solaris/linux you have to use this to log on to MySQL: shell> /usr/local/mysql/bin/mysql -h faure -D loginname -p shell> mysql -h host -u user -p Enter password: ******** The ******** represents your password; enter it when mysql displays the Enter password: prompt.
Background image of page 4
Basic Query: select A 1 , A 2 ,…,A n from r 1 , r 2 , …,r m where P; A 1 , A 2 ,…,A n represent attributes r 1 , r 2 , …r m represent relations P represents predicate (guard condition) Keywords may be entered in any letter case : mysql> SELECT VERSION(), CURRENT_DATE; mysql> select version(), current_date; mysql> SeLeCt vErSiOn(), current_DATE;
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Prompt Meaning mysql> Ready for new command. -> Waiting for next line of multiple-line command. ‘> Waiting for next line, collecting a string that begins with a single quote (` ’ ’). “> Waiting for next line, collecting a string that begins with a double quote (` ” ’). mysql> SELECT * -> FROM my_table -> WHERE name = “Smith” AND age < 30; mysql> SELECT * FROM my_table WHERE name = "Smith AND age < 30; "> "\c mysql> \c to cancel the execution of a command
Background image of page 6
Basic Database Operation Create a database Create a table Load data into the table Retrieve data from the table in various ways Use multiple tables Suppose you have several pets in your home (your menagerie) and you'd like to keep track of various types of information about them. You can do so by creating tables to hold your data and loading them
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/25/2011 for the course CS 430 taught by Professor Staff during the Summer '08 term at Colorado State.

Page1 / 20

GoodSQLIntro - How to Use MySQL CS430 SQL"Structured Query...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online