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

Info icon This 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
Image of page 1

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

View Full Document Right 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
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/
Image of page 3

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

View Full Document Right 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.
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;
Image of page 5

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

View Full Document Right 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
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.
Image of page 7

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

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

{[ snackBarMessage ]}

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