database outline database introduction - saddleback … mys… · •tutorial assignment separate...
Post on 19-Mar-2018
219 Views
Preview:
TRANSCRIPT
1
Introduction MySQL
Open Source RDMBS& SQL Interface
2Intro MySQL
Intro Videos
1) Database Intro:• Terminology, Objectives, Types, Major Players
2) MySQL/SQL Intro – DB Evolution3) SQL Command Overview4) SQL IDE Environments MySQL WorkBench, PHPMyAdmin, or optional Netbeans SQL Editor
• Tutorial Assignment Separate Viewgraphs1) Terminal Connection or MySQL/WorkBench Install2) Terminal Connection w MySQL Client
or MySQL Work Bench – SQL Editor
© 8/15, 3/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
DatabaseIntroduction
TerminologiesCourse Goal is to Learn SQL & Familiar RDBMS
Global Prespective: Market Shares & MySQL Growth4
Intro MySQL© 8/15, 3/13 , 6/11, 8/08 & 11/2005 Professor T. DeDonno
Database Outline
• Database Definitions, Objectives & Structures• Fruit Relational Database Example• RDBMS Market Share• SQL Definition - History
• MySQL• MySQL Popularity: Jobs, Books• DB Careers• Saddleback Classes
2
5Intro MySQL© 8/15, 3/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
Databases • Database is a Collection of Tables
• Table (2-D Row/Column File) Data Set Organized into Rows & Columns In a specific table all rows share the same columns- Table is a Single Row/Column Spreadsheet
- Relational Database Management System (RDBMS)- Tables Have Relationships Within themselves & between others
• Row is a record: collection of fields• Column is a field: single data item/entity 6
Intro MySQL© 8/15, 3/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
Two Table RDBMS• fruitID is Key That Relates Tables
Table: fruitfruitID Name Price1 apple 2.502 pear 3.004 grpe .755 peach 1.258 pluot 4.506 plum 1.253 banana 1.00
Table: inventoryfruitID quantity1 1003 5002 1005 101 2502 200
7Intro MySQL
Database Objectives
• Seek to Organize Large Amounts of Information• Retrieve Data By Asking Questions “Query”
• Database Programmer Sets up the Query “SQL” Analyst Organizes the Tables
• RDBMS Synchronous Simultaneous User Continuously Update Data
© 8/15, 3/13m 6/11, 8/08 & 11/2005 Professor T. DeDonno
8Intro MySQL© 8/15, 3/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
Database Privileges• Operating System File Privileges
Lock a File When One Application is using It Remember to Save File in Application
• Database Privileges on Steroids• Lock Not Only a File but Parts of a File
These User can Write these Files/Rows These User Can Only Read This Column
• Synchronized DB Access (Multiple User at Once)• Lock, Write Record, Unlock, • Wait to Read Updated Record
3
9Intro MySQL© 8/15, 3/13, 6/11, 4/10, 3/08 & 11/05 T. DeDonno
PHPMyAdminPrivilegePage
Detailed PrivilegeApplied to Table Set(aka DB/Schema),
Table or just Part of a Table
10Intro MySQL©8/15, 3/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
Database Structures• Hierarchy Directory Structure – File system Folders LDAP/Active Directory Services
• Flat: NIS/AWK, Outlook, /etc/passwd
• Relational Databases Minimize Repeat Information By…
• Relating Tables – Usually with a Key• Each Row Has a Key(s) For Identifying & Indexing
Codd’s Developed Original 12 Rules Cimw105 Tables Form & Have Relationships
11Intro MySQL© 8/15, 6/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
A Typical Relational SchemaTwo Tables Related by fruitID
Inventory: fruitIDrefers to fruit: fruitID
12Intro MySQL© 8/15, 6/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
Fruit Table ContentsfruitfruitID name price1 apple 2.502 pear 3.004 Grpe 0.755 peach 1.258 pluot 4.506 plum 1.253 banana 1.00
inventoryInventoryLinefruitID quantity1 1003 5002 1005 101 2502 200
4
13Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Database Occupations…• Information Processor/Data Entry Enter Data Into Database
• Data Analyst Specialist in Organizing Data Tables Contents, and Relationships
• Database Administrator – System Admin
• Web Developers/Programmers Modern Day Program=
Traditional + GUI + Web Enabled + SQL +Multi-Processor14
Intro MySQL©8/15, 6/11, 8/08 & 11/2005 Professor T. DeDonno
Saddleback Courses
CLIENTServer w
PHPEngine
cimw245
TCP Get
TCP Put
MySQLServer
SQL Requestcimw 105
Status and/or Send Data
DHTML PHP + MySQL Library + MySQL Data
Also Offer…CS1B or CIMP7A CS4A Java CS4B (Java Web Programming)CIM/Glassfish – J2EE/JSP/JDBC Web Application Server
15Intro MySQL© 8/15, 6/11, 8/08 & 11/2005 Professor T. DeDonno
CS4B
CLIENTTomcat
JSP Engine W JConnector
TCP Get
TCP Put
MySQLServer
SQL RequestDriver
Status and/or Send Data
DHTML JSP + JDBC + MySQL Data
JConnector Java Interface (aka Driver ) to MySQLSame AsDHTML PHP + MySQL Library + MySQL Data 16
Intro MySQL©6/11, 8/08 & 11/2005 Professor T. DeDonno
SW Industry• http://www.softwaretop100.org/list.php?page=1• Top 4 Are All RDBMS Oriented• 2006 SW/DB Revenue = $140B/$17.1B = 12%
Company SW-10Revenue-Growth
SW-09RevenueGrowth
SW -07 RevenueGrowth
06 TotalRevenue
DB 06Revenue
06 % DB Revenue
Microsoft $49B -1%
$49B 10%
$37B08%
$45B $2.6B 82%
IBM $21.4B-3%
$22B11%
$18B08%
$91B $3.2B 20%
Oracle $18.56%
$17B17%
$13B34%
$16B $7.2B 79%
SAP $11.3-2%
$11B08%
$09B24%
$12B 0%
5
17Intro MySQL© 8/15, 11/2005 & 8/08 T. DeDonno
RDBMS Market Shares• http://www.gartner.com/it/page.jsp?id=507466• http://www.informationweek.com/news/software/info_management/207402230
• As 2015, Oracle DB Revenue is Greater than Top 4 Combined.
2010 07Oracle 48.1% 44.1% Effectively Added PeopleSoft,
(07Siebel) and Sun MySQL IBM 22% 21.3% DB2, Open Source OptionMSFT 10% 11.2% SQL Server, AccessOthers 20% 23.4% Teradata 1B; SAP
18Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Database Quiz QuestionsA Database is a Collection of _______.A Table is a collection of ______ or ____A Row contains _______ or ______.RDBMS Stands for?RDBMS Form ____________ among/between Tables Minimize ____________ Information.
When You Ask a DB a Question You are?
MySQL/SQLIntroduction
SQL – History/DefinitionsDB Evolution
MySQL Key Points & Popularity20
Intro MySQL© 9/15, 3/13 , 6/11, 8/08 & 11/2005 Professor T. DeDonno
SQL: Structured Query Language • Session Layer Protocol for Network RDBMS Access Make Connection: Then Maintain Connection Entire Session
• 1970 IBM Developed Sequel 1980 SQL (Called Sequel or “ESS CUE EL”)
• Oracle (Former IBM Employees) Emphasized SQL• Has Become a De facto RDBMS Standard
• PL/SQL (Procedure Language) Oracle Developed Procedural Extension Language for SQL PHP/MySQL, or Oracle DB: Java, SQL & PLSQL
6
21Intro MySQL© 3/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
DBEvolution
Gone Full CircleEnterpriseSolutions
1960sIts
Enterprise
IBMHW/DB/
SW/Support
1977Its
DB Dummy
OracleDarlingSQL/DBSupport
Its SW DummyHyperGrowth
People Soft/1987Siebel/1992
ItsEnterprise
DummySun
HW/MySQL/Support
DB/SWOracleBrought
People Soft/1-05Siebel/9-2005
Sun/200922
Intro MySQL
Four Horseman 90s
• Didn’t define horseman for 2010, usually appl, goog, and orcl.
• Only orcl continued to Perform©3/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
23Intro MySQL
Solution versusSystem
• Dell is also getting hit PC versus Intelligent Device In 2013 Dell Became a Private Comany
© 8/15, 6/11, 8/08 & 11/2005 Professor T. DeDonno
2011 – 2015Oracle, IBM, HPQ
24Intro MySQL© 815, 3/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
MySQL.com Key Points• Open Source RDMS With Full SQL Implementation• Web Hosting Sites Usually Provide 1 MySQL DB
• Interfaces to PHP, Perl, C++, Python, Java;• Supports PLSQL (Procedural Language)
• The Open Source Database 65,000 Downloads Per Day http://www.mysql.com/why-mysql/marketshare/
• 4/2009 Purchased by Oracle, Target SQL-Server Competitor• 2013-2015 MariaDB (MySQL Fork) has some penetration
7
25Intro MySQL© 3/13, 6/11, 8/08 & 11/2005 Professor T. DeDonno
MySQL Purchases• MySQL Open Source Project Wikipedia PHP/MySQL System MediaWiki
• Sun Buys MySQL $1B 1/2008; 11Million Installations
• IBM Considered $6B Offer for Sun (Datacenter) Would have Been a Lot of Duplication of Effort
• 4/20/2009 Oracle Buys Sun for $7.4B Enterprise Solution: HW, SW, DB & Support Enhanced Oracle Stack: PLSQL, Java (Sun Java), SQL Entry Level DB MySQL
26Intro MySQL© 8/15, 8/11, 8/08 & 11/05 Professor T. DeDonno
MySQL Software Evolution• 2000 LAMP Stack
Linux Apache MySQL PHP Open Source SW Stack for Developing Web Applications Why LAMP? PHP3,4 Most Used Server-Side Scripting Language
• Fun to Use – Rock n Roll is only 3 Notes
• LAMP Applications Joomla, WordPress, Drupal, Google (non Search) Wikipedia, Facebook – Front end
• Facebook, PHP not Well Suited for Large System
• 2007 MySQL 5.0, PHP 5.0 & PHP Collaboration Push into Large System DB2 & Oracle Large Systems Standards (Ebay uses Oracle)
• Open Source Forks MariaDB – GPL Emphasis, Drizzle Cloud Computing
27Intro MySQL
Oracle MySQL Plans
• Feb 2011 Targeting MS SQL Server
• Oracle – Microsoft Long Competitive History 1995 Oracle Released Thin Network Client
• Failed Sub $500 PC Windows Vista Alpha “longhorn” had RDMBS Attempts to Streamline Oracle DB Failed
• Oracle Open Source & Support Version http://mysql.com/products/ Strong Java Integration
© 8/15, 6/11, 8/08 & 11/2005 Professor T. DeDonno
28Intro MySQL
Google Trends
© 6/11, 8/08 & 11/2005 Professor T. DeDonno
2007 News Headlines (Take over Rumors)MS did release SQL Server 2008IBM Database DB2 is 2nd Most Used DatabaseOracle keyword is Searching Oracle and Oracle Base
8
29Intro MySQL© 11/2005 & 8/08 T. DeDonno
Certcities.com Hot Certificates – not have 07-20102006 2005 2004 2003 2002
1 RHCE CCIEInternetwork Expert
MCSE:Security
CCIE MCSA
2 MS SQL .net MCSE:Security
Tie Security+,CCIE
Security+ Oracle: DBA
3 MS Certified Architect
RHCE – Redhat Certified Eng.
RHCE CCNA Cisco
4 CCSP & PMP Cisco Certified Security Pro.
CCNP CCNP CCNP
5 CCNP Cisco C Net Pro.
RHCE Certified Info. Sys. Security Pro. CISSP
MCDBA
6 Cisco Inter-network Expert
Linux Pro. Institute
MCDSTMS DesktopSupport
Checkpoint Certified Security Admin
RHCE
7 CCNP Novell Linux CISSP, MCSE,MS Exchange
Linux+ CompTIA Network+8 MSCE: Sec MySQL MCSA Microsoft
Cert Sy Ad.Citrix Cert. Ad.
9 SSCP System Security
Security+ MCDBA MS DB Admin.
Sun Solaris SA Java Pro
10 Linux Pro PMP PMP MCDMA, Citrix Enterprise
CISSP30
Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Dice.com (8/08 or 3/06 probably last 60 days)Keyword 6/11
all Days8/08
Last 60 Days3/15/06
Last 60 DaysSQL 23,815 23,249Oracle 17,914 18,900 DB Admin + SW/SQLJava 16,335 15,349 14,617SQL Server 13,534 13,421C++/C# 5959/7865 7,837 7,682JavaScript 9689 6,595 3,730Perl/Python 5150/2738 5,367 4348VB 2841 3,841DB2 2465 2,738PHP 3169 2,536 Accelerated Growth 976MySQL 3268 2,415ActionScript 459 748 163Ruby 1676 787 133
* Hotjobs.com is not Hot
31Intro MySQL
Indeed.com (has more)6/10/2011
Total (last 7 Days) 982,575SQL 151,133Oracle/”SQL Server”/MySQL 109K/54K/21KJava 100,274C#/C++ 48,647/59,231XML/JavaScript/CSS 58K/55K/40KASP/PHP/JSP 33K/23K/16.5KPython/Perl/VB 21K/37K/17KActionScript/PLSQL/JSON 5K/1K/6K
©6/11, 8/08 & 11/2005 Professor T. DeDonno
Google is using Python; Adroid supports ActionScriptFive Year Analysis
SQL/Java always at TopC#/C++ Second TierWeb Growing Fast XML/JS/CSS, ASP/PHP/JSP, ActionScript 32
Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Amazon Book Momentum
• Momentum Key:>20% Hot Sun Rising15% Mid Day
<10% “Cooling Off Sun Setting – less being Published”
MySQL has 22%?
Search Total Books6-11/08/06
After 6/09
Oracle 8.8K/12K/2k 1.5KSAS 4.6K/6K/2K 561SAP 3.2K/7K/1K 653SQL Server 5K/5.6K/1K “SQL Server” drop offDB2 208K/4K/.4K Not AccurateMySQL 1.6K/3K/.3 361 – 22%
9
33Intro MySQL
Indeed.com
© 8/15, 6/11, 8/08 & 11/2005 Professor T. DeDonno
34Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Database is Hot to StaySQL/RDBMS Standard
• More and More Data
• Data is Worthless Unless Organized Better Search Engines Google Desktop Search
• Beagle (Bleeding Edge Search Tool) Implement SQL on Desktop
• Original LongHorn/Vista Objective Database Seeks Organize Data
DataInformationKnowledgeWisdom
Organization
Meaning
35Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
MySQL Quiz SummarySQL Stands For?MySQL supplies both a _____ and SQL
Language InterfaceOracle SW Development Stack?
LAMP SW Development Stack?
If You Learn MySQL commands you also know DB2, Oracle and SQL Server?
Oracle Wise Move Buying Sun/MySQL?
SQL CommandsOverview
SQL Language in a Nutshell
SQL SyntaxSelect expression from TableCreate – Column/Field Types
Drop, show, useData Manipulation: delete, Insert into, update set
10
37Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Outline – Basic SQL Commands• SQL Syntax• Select Examples
• Create & Field/Column Types• Drop, show, and use
• Data Manipulation: delete, insert & updates• SQL/MySQL Command Summary Table
• Learn Select, rely on IDE as Crutch38
Intro MySQL© 8/15, 6/11, 8/08 & 11/2005 Professor T. DeDonno
SQL Syntax• SQL Commands & Functions case insensitive SELect name FRom fruit== select name from fruit Note Readability SELECT name FROM fruit; Column Names case insensitive
but best pracitice treat as Case sensitive• Tables and User Names are Case Sensitive Can have Letter, Underscore or Numbers, Use Letter First
• All SQL Commands End with ; (Record/Row) or \G (Record/Column)
• Use Parenthesis and New Lines for Readability• # Begins Comment to End of Line
39Intro MySQL© 8/15, 6/11, 8/08 & 11/05 Professor T. DeDonno
Select Table Data – Display Expression
• Select [expression] [ from table ];
• Need to Learn Select; Others Use IDE as Crutch
Expression Description Example Output* Wild Card Display all select * from fruit; 1 Apple 2.50
2 Pear 3.00Field Name Display only Field Name Select name, price
from fruit;Apple 2.50Pear 3.00
String Double quote delimited Select “hello”; helloArithmetic 3+5 Select 3+5; 8Function Execute a function Select now(); Current TimeMixture Combine comma
separatedSelect name, max(price) from fruit;
Apple 3.0
40Intro MySQL© 8/15, 6/11, 8/08 & 11/2005 Professor T. DeDonno
Order & Limit Output• Select expression [ from table ]
[order by field Name [ ASC | DESC ] ][limit [offset, ] row Count ] ;
• Order (aka sort) by field name either ASCending or DESCending
• Limit offset_starting_row, rows_to_display
Query OutputSelect max( quantity ) from inventory; 200Select max( price ) from fruit; 3.00Select name, max(price) from fruit; Apple 3.00select “Most Expensive:”, name, max(price)from fruit order by price DESC limit 1;
Most expensive: Pear 3.00
11
41Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Where Conditional• Select expression [ from table ]
[ where conditional_is_true ][ order by fieldName ASC ] [ limit start, count ];
Select name from fruitwhere price = 3.0
pear
Select name from fruitwhere price < 3.0
apple
Select name from fruitwhere price > 3.0
Empty Set
Select name from fruitwhere price >= 3.0
pear
Select name from fruit whereprice != 3.0;
apple42
Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
SQL Command create• Create database DBName; Creates the relative Database SBUser don’t have privileges to create a database
• Create table tableName(fieldName fieldTypes[,] );• Create table fruit
( fruitID smallint primary key, name varchar(8), price decimal(5, 2) );
• Creating tables is easy with PHPMyAdmin
fruitID name pricesmallint varchar(8) decimal(5,2)
43Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Column/Field Types
• Number• int 32 bit, tinyint 8 bit, smallint 16 bit, bigint 64 bit• float(m,d), double(m,d), decimal( m, d)
• Date & Time• date yyyy-mm-dd; datetime yyyy-mm-dd hh:mm:ss• year(2), year(4), timestamp – Unix time stamp no hyphens
• String• char(length), varchar(length)• blob & text 216; longblob 232 ; tinytext 28
• Enum( ‘spring’, ‘summer’, ‘fall’ );44
Intro MySQL© 8/15, 6/11, 8/08 & 11/05 Professor T. DeDonno
SQL Commands – drop, show, use
• Use databaseName; Use database Specified, Must always 1st Select schema
• drop [database DBName | table tableName] ; Deletes The Named Database or Table
• show [databases | tables ] Display databases or Tables within Database
• show columns from fruit; Alias describe fruit;
fruitID smallintname varchar( 8 )price decimal( 5, 2 )
12
45Intro MySQL© 8/15, 6/11, 8/08 & 11/05 Professor T. DeDonno
SQL Data Manipulation• insert into fruit
(`name`, ‘price`) values (‘banana’, 1.00);
• delete from fruit order by price desc limit 1;
• update fruit set price=1.25 where fruitID=1;
1 apple 2.502 pear 3.003 banana 1.00
fruitID name price1 apple 2.503 banana 1.00
fruitID name price1 apple 1.253 banana 1.00
Table: fruitfruitID name price1 apple 2.502 pear 3.00
46Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Show databases; Show columns from tableNameUse dbName; #Uses specified Databases Select * from tblName; #Display all rowsSelect * from tblName [where | limit | order by];Where conditional; limit offset #rows #1st row is 1Order by fieldName [asc default | desc];Insert into table values(‘tom’),(‘dawn’);delete from table [where | limit | order by];update tblName set name=‘tom’ [w|l|o];Create table tblName (fieldNames fieldTypes[,]);
SQL Command Summary
47Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Basic SQL Command Quiz
Match The Two Columns1) Show Available Databases (a) insert2) Use a Specific Databases (b) order by3) Show Tables in Selected DB (c) show databases;4) Select keywords sort display (d) use DBJStudent1;5) Drop table A in selected DB (e) where6) Keyword add Row to Table (f) select7) Select conditional keyword (g) drop table a;8) The SQL keyword (h) show tables; 48
Intro MySQL© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Intermediate Quiz
(1) Display contents oftable : fruit
(a) Insert into fruit values( ‘banana’, 0.19 );
(2) Insert banana at .19 into table:fruit
(b) select * from fruitwhere price > 5;
(3) Delete apple from fruit (c) update fruit setprice = 5 where fruitID=2;
(4) Cmd to list all fruit elements with price over $5.0
(d) select * from fruit;
(5) Change pear to $5.0 (E) delete from fruit where fruitID=1;
13
SQL IDEsOutline
General IDE RequirementsSpecific SQL IDE Requirements
Applications
50Intro MySQL
SQL IDE Keypoints• Improved a Lot in Recent Years• Many Applications have SQL/RDB Integration
• General IDE/RAD Tool Requirements• Specific SQL Requirements• SQL Editor Genres• IDEs That Meet Requirements• tutorial.sql Assignment Tool Choice
© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Outline
51Intro MySQL
General IDE Requirements• IDE – Integrated Developers Environment One Stop Debugging/Editing/Execution Streamline-Shorten Development Cycle
• RAD – Rapid Application Development Complete Commands @ Higher Level Abstraction
• Real time Syntax Checking• Ctrl^Space Universal Code Completion• Drag/Drop, Click & Right Click Short-Cuts© 6/11, 8/08 & 11/2005 Professor T. DeDonno
52Intro MySQL
Specific SQL IDE Requirements1) Query Editor – Ask DB a Question 2) Data Manipulation Insert Update or Delete Table Contents, Alter Structure
3) Administration Add Users, Export/import Data, Start Stop server
4) Data Modeling5) Programmers Interface6) Report Generation
© 6/11, 8/08 & 11/2005 Professor T. DeDonno
Ancillary
14
53Intro MySQL
Ancillary SQL IDE Requirements4) Data Modeling Determine Database Schema DB has These tables with these fields These keys form relationships
5) Programmers Interface Integrate & Get Queries for Java/C/PHP etc. PL SQL – Procedure Language SQL Execute SQL Scripts as in Batch
• Class Lists Questionnaire/SQL Accounts
6) Reports – use this table inside a sales report
© 6/11, 8/08 & 11/2005 Professor T DeDonno
54Intro MySQL
CIMW105 SQL Tools • Command Line client Ships w MySQL Server Universal Batch Command (class list CIM/MySQL)
• MySQL Work Bench Disadvantage Port 3306 is Almost Always closed Three Tools: SQL Editor, Model-Design, Administrator
• PHPMyAdmin Web-Based Standard Alternate but Linux Only webmin
• Programming Environments Netbeans SQL Editor Well Integrate; Eclipse More Popular
• Reports: Open Office/Libre Office, Jasper Reports
© 8/15, 5/11, 8/08 & 11/2005 Professor T DeDonno
55Intro MySQL
CIMW105 Tool Comparison (0..5)Query Data
Manip-ulation
Admini-stration
Model-ing
InterfaceJava-PHP/PLSQL/Script File
Reports
WorkbenchLocal
3 3 4 4 0,0,3 0
PhpMyAdminWeb-Based
4 5 4 3Designer
4,0,0 1Export fmt
NetBeansLocal
3.5 4 1 1 3,3,3Add PLSQL Plugin
3 addI-ReportsPlugin
©8/15, 5/11, 8/08 & 11/2005 Professor T DeDonno
WorkBench only works locally, no one opens port 3306, real time syntax checkingphpMyAdmin defacto Web Standard – Universal, But Not Good w Script FilesNetbeans well integrated IDE, Real time Syntax Checking, Auto CompletionPLSQL requires NetBeans Add-on or JDeveloper – Oracle NetBeansMySQL Client is not an IDE, its part of the IDE 56
Intro MySQL
tutorial.sql Tool ChoiceMySQL Client MySQL WorkBench
Part of MySQL Server Separate InstallationI don’t debug failed Installations
Putty – Secure Terminal Connection Install MySQL Locally
Familiarity with Command Line Interface GUI Interface
Running submit from command lineSuperior Error Reports
Submit tutorial.sql on Web
© 8/14, 5/11, 8/08 & 11/2005 Professor T DeDonno
Can Do Both, but only Hand in tutorial.sql using PHPMyAdminDeprecated Paths Putty/WorkBench create different tutorial.sqlLater on PHPMyAdmin Assignment, Well Recommended ToolCasino.sql Assignments will Demo Netbeans
15
57Intro MySQL© 8/15, 5/11, 8/08 & 11/2005 Professor T DeDonno
Mysql Command Line Interface
• mysql [–h hostname] –u username –p [DBUsername] mysql –h cim.saddleback.edu
• Square Brackets are always Optional• For -h port 3306 Must be Open on Server
mysql –u SBUsername –p• Start MySQL with SBusername, followed by Password Prompt• Note You don’t want to have Passwords on Command Line
[DBsbusername]• Can Optionally Specify DB at Command line; • Mysql Prompt > use DBsbusername;
• mysql –u username –ppassword –e “source xyz.sql” 58Intro MySQL© 8/15, 5/11, 8/08 & 11/2005 Professor T DeDonno
MySQL Client Command Line Editing• Up Arrow Back a Command• Edit Command using Arrow delete, backspace, and insert key
• Hit Enter to enter the Command “Remember ;”• ? At MySQL Prompt for Help
• Sending mySQL output to screen and File tee outputFile; #echo screen to File notee # turns off Tee
59Intro MySQL© 8/15, 5/11, 8/08 & 11/2005 Professor T DeDonno
Other Editors to Considers• Mac X-Code (SQL Plug-in)• vi (linux/Mac), gvim (pc) Vi has automatic SQL syntax highlighting Works Anywhere (Edit Fast) But Another Learning Curve NetBeans has a VI plugin
• Notepad++• Sublime – has gotten popular in recent years• textpad with a sql Syntax Definition
60Intro MySQL© 8/15, 5/11, 8/08 & 11/2005 Professor T DeDonno
TextPad/Sublime Adding Plug-in
• Get oracle sql add-on• Extract sql.syn c:\program files\textPad 5\system• Inside Text Pad
click on Configure, New Document Class• call it SQL, click next• type *.sql, click next• check "enable syntax highlighting"• choose sql.syn from the drop down box• click next then finish• restart TextPad
top related