SlideShare a Scribd company logo
1 of 66
mySQL  and Relational Databases By Jeff Smith
mySQL and Relational Databases What is a Database? ,[object Object],[object Object],[object Object]
What is a Table ? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Table Concepts and Terms -1 ,[object Object],[object Object],[object Object]
Table Concepts and Terms -2 Table: PhoneBook Columns or Fields: Company, Address, City, State, Zip, Phone
Keys of a Table -1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Keys of a Table -2 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],MODEL_GROUP  ---------------------------------- MODEL_GROUP_ID (PK) USER_ID (FK) MODEL_GROUP_NAME
Indexes (Indicies) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Referential and Domain Integrity ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
About mySQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Setting up a mySQL Database - 1 ,[object Object],[object Object],[object Object],[object Object]
MySQL Table Engines ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MySQL Data Types ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Setting Up Database With A Script ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 
Setting up a Database - 3 ,[object Object]
Basic SQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, SELECT statement -1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, SELECT statement -2 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, SELECT statement -3 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, SELECT statement -4 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, SELECT statement -5 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, SELECT statement -6 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, INSERT statement -1 ,[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, INSERT statement -2 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, UPDATE statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic SQL, DELETE statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Common MySQL Commands -1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Common MySQL Commands -2 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Common MySQL Commands -3 alter table [table name] drop index [colmn name]; Delete unique from table. alter table [table name] modify [column name] VARCHAR(3); Make a column bigger. alter table [table name] add unique ([column name]); Make a unique column so you get no dupes. alter table [table name] change [old column name] [new column name] varchar (50); Change column name. alter table [table name] add column [new column name] varchar (20); Add a new column to db. alter table [table name] drop column [column name]; Delete a column.
Summary ,[object Object],[object Object],[object Object],[object Object],[object Object]
Squirrel SQL Client ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Squirrel SQL Client Installation ,[object Object],[object Object],[object Object],[object Object],[object Object]
Squirrel SQL Client Installation -1 ,[object Object]
Squirrel SQL Client Installation -2 ,[object Object]
Squirrel SQL Client Installation -3 ,[object Object]
Squirrel SQL Client Installation -4 ,[object Object],[object Object],[object Object]
Squirrel SQL Client Installation -5 ,[object Object]
Squirrel SQL Client Installation -6 ,[object Object]
Squirrel SQL Client Installation -7 ,[object Object]
Squirrel SQL Client Installation -8 ,[object Object],[object Object]
Squirrel SQL Client Installation -9 ,[object Object]
Squirrel SQL Client Installation -10 ,[object Object]
Squirrel SQL Client Installation -11 ,[object Object]
WHERE Clause ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Selecting the COUNT ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Selecting the MIN or MAX ,[object Object],[object Object],[object Object],[object Object],[object Object]
Selecting the SUM ,[object Object],[object Object],[object Object],[object Object],[object Object]
Joining Tables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sub Queries -1 ,[object Object],[object Object],[object Object],[object Object]
Sub Queries -1 ,[object Object],SELECT name FROM employee E WHERE E.dept_no = (SELECT dept_no FROM employee WHERE  name = 'Zirsky') This selects the names of all the people who work in the same department as ‘Zirsky’ This sub query must return a single row (or no rows) since the Comparator is an ‘=‘ (equals sign). If there are two ‘Zirsky’s, you’ll get a SQL error
Sub Queries -2 ,[object Object],[object Object],SELECT name FROM employee E WHERE E.dept_no IN (SELECT dept_no FROM employee WHERE  name = 'Zirsky‘ OR name = ‘Thompson’) This selects the names of all the people who work in the same department as ‘Zirsky’ or ‘Thompson’
Correlated Sub Queries -2 ,[object Object],SELECT name FROM employee E WHERE E.employee_id NOT IN  (SELECT employee_id FROM benefits) This selects the names of all the people who are not in the benefits table (they have no benefits)
Aggregate Selects (GROUP BY) -1 ,[object Object],[object Object],SELECT count(*), E.name FROM employee E, doctor_visits DV WHERE E.emp_id = DV.emp_id GROUP BY E.name This selects the employee names and number of doctor visits they’ve had. For example 4  John Doe 2  Maggie Smith
Aggregate Selects (GROUP BY) -2 ,[object Object],SELECT count(*), E.name FROM employee E, doctor_visits DV WHERE E.emp_id = DV.emp_id GROUP BY E.name This selects the employee names and number of doctor visits they’ve had. For example 4  John Doe 2  Maggie Smith 3  Tom Jones
Aggregate Selects (GROUP BY) -3 ,[object Object],SELECT count(E.name), E.name FROM employee E, doctor_visits DV WHERE E.emp_id = DV.emp_id GROUP BY E.name HAVING (COUNT(E.name) > 2) This selects the employee names and number of doctor visits they’ve had IF they’ve had more than 2 visits. For example 4  John Doe 3  Tom Jones
Outer Joins -1 ,[object Object],[object Object],[object Object],[object Object]
Outer Joins -2 ,[object Object],SELECT E.name FROM employee E  LEFT OUTER JOIN  DOCTOR_VISITS DV ON E.emp_id = DV.emp_id Selects employee names and doctor visits, one row per doctor visit. If the employee has no doctor visits, his name still appears in the results, but with NULL values for doctor visits. In this example, John Doe had a doctor visit while Tom Jones did not. E.Name  DV.Date  DV.Reason ---------------------------------------------------- John Doe  02/10/2005  Sore throat  Tom Jones  NULL  NULL
Outer Joins -2 ,[object Object],SELECT E.name FROM employee E  LEFT OUTER JOIN  DOCTOR_VISITS DV ON E.emp_id = DV.emp_id WHERE DV.emp_id IS NULL Selects employee names who have no doctor visits E.Name  DV.Date  DV.Reason ---------------------------------------------------- Tom Jones  NULL  NULL
What We Didn’t Cover ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MySQL Exercise -1 ,[object Object],[object Object],STUDENT ------------------- STUDENT_ID (PK) FIRST_NAME LAST_NAME GENDER (CHAR ‘M’ or ‘F’) First name/Last name combo Must Be unique COURSE ---------------------------------- COURSE_ID (PK) COURSE_NAME COURSE_NUMBER (INT) Course Name/Number combo should be unique
MySQL Exercise -2 REGISTRATION ---------------------- REGISTRATION_ID (PK) STUDENT_ID COURSE_ID STUDENT_ID and COURSE_ID should be foreign keys
MySQL Exercise -3 ,[object Object],STUDENTS ---------------- John Doe Tom Jones Sally Smith Jennifer Smith COURSES --------------- Physics 101 French 101 French 201 REGISTRATIONS ------------------------ John Doe, Sally Smith, Tom Jones in Physics 101 Tom Jones in French 101 Sally Smith in French 201
MySQL Exercise -4 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MySQL Exercise -5 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MySQL Exercise -6 ,[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot (19)

Mysql cheatsheet
Mysql cheatsheetMysql cheatsheet
Mysql cheatsheet
 
mysqlHiep.ppt
mysqlHiep.pptmysqlHiep.ppt
mysqlHiep.ppt
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
DML using oracle
 DML using oracle DML using oracle
DML using oracle
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
Ddl commands
Ddl commandsDdl commands
Ddl commands
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
SQL DDL
SQL DDLSQL DDL
SQL DDL
 
DDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using OracleDDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using Oracle
 
Oracle: DML
Oracle: DMLOracle: DML
Oracle: DML
 
DBMS information in detail || Dbms (lab) ppt
DBMS information in detail || Dbms (lab) pptDBMS information in detail || Dbms (lab) ppt
DBMS information in detail || Dbms (lab) ppt
 
Assignment#02
Assignment#02Assignment#02
Assignment#02
 
1 ddl
1 ddl1 ddl
1 ddl
 
Sql12
Sql12Sql12
Sql12
 
Sql commands
Sql commandsSql commands
Sql commands
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Mysql
MysqlMysql
Mysql
 

Viewers also liked

Viewers also liked (15)

MySQL Record Operations
MySQL Record OperationsMySQL Record Operations
MySQL Record Operations
 
Sending emails through PHP
Sending emails through PHPSending emails through PHP
Sending emails through PHP
 
Javascript
JavascriptJavascript
Javascript
 
Mysql
MysqlMysql
Mysql
 
Css
CssCss
Css
 
Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
 
File organization
File organizationFile organization
File organization
 
File organization 1
File organization 1File organization 1
File organization 1
 
Relational vs. Non-Relational
Relational vs. Non-RelationalRelational vs. Non-Relational
Relational vs. Non-Relational
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
MySQL
MySQLMySQL
MySQL
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL Presentation
 
MySQL partitions tutorial
MySQL partitions tutorialMySQL partitions tutorial
MySQL partitions tutorial
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
 

Similar to mySQL and Relational Databases

MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinhwebhostingguy
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxEliasPetros
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxEliasPetros
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql newSANTOSH RATH
 
Database models and DBMS languages
Database models and DBMS languagesDatabase models and DBMS languages
Database models and DBMS languagesDivyaKS12
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfpradnyamulay
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasadpaddu123
 
Introducing ms sql_server_updated
Introducing ms sql_server_updatedIntroducing ms sql_server_updated
Introducing ms sql_server_updatedleetinhf
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic ConceptsTony Wong
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETEAbrar ali
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptDrRShaliniVISTAS
 
Mysqlppt
MysqlpptMysqlppt
MysqlpptReka
 

Similar to mySQL and Relational Databases (20)

MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
 
Module 3
Module 3Module 3
Module 3
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
Database models and DBMS languages
Database models and DBMS languagesDatabase models and DBMS languages
Database models and DBMS languages
 
Sql
SqlSql
Sql
 
SQL Query
SQL QuerySQL Query
SQL Query
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
 
SQL
SQLSQL
SQL
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Introducing ms sql_server_updated
Introducing ms sql_server_updatedIntroducing ms sql_server_updated
Introducing ms sql_server_updated
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
 
chapter 8 SQL.ppt
chapter 8 SQL.pptchapter 8 SQL.ppt
chapter 8 SQL.ppt
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 

More from webhostingguy

Running and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test FrameworkRunning and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test Frameworkwebhostingguy
 
MySQL and memcached Guide
MySQL and memcached GuideMySQL and memcached Guide
MySQL and memcached Guidewebhostingguy
 
Novell® iChain® 2.3
Novell® iChain® 2.3Novell® iChain® 2.3
Novell® iChain® 2.3webhostingguy
 
Load-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web serversLoad-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web serverswebhostingguy
 
SQL Server 2008 Consolidation
SQL Server 2008 ConsolidationSQL Server 2008 Consolidation
SQL Server 2008 Consolidationwebhostingguy
 
Master Service Agreement
Master Service AgreementMaster Service Agreement
Master Service Agreementwebhostingguy
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...webhostingguy
 
Dell Reference Architecture Guide Deploying Microsoft® SQL ...
Dell Reference Architecture Guide Deploying Microsoft® SQL ...Dell Reference Architecture Guide Deploying Microsoft® SQL ...
Dell Reference Architecture Guide Deploying Microsoft® SQL ...webhostingguy
 
Managing Diverse IT Infrastructure
Managing Diverse IT InfrastructureManaging Diverse IT Infrastructure
Managing Diverse IT Infrastructurewebhostingguy
 
Web design for business.ppt
Web design for business.pptWeb design for business.ppt
Web design for business.pptwebhostingguy
 
IT Power Management Strategy
IT Power Management Strategy IT Power Management Strategy
IT Power Management Strategy webhostingguy
 
Excel and SQL Quick Tricks for Merchandisers
Excel and SQL Quick Tricks for MerchandisersExcel and SQL Quick Tricks for Merchandisers
Excel and SQL Quick Tricks for Merchandiserswebhostingguy
 
Parallels Hosting Products
Parallels Hosting ProductsParallels Hosting Products
Parallels Hosting Productswebhostingguy
 
Microsoft PowerPoint presentation 2.175 Mb
Microsoft PowerPoint presentation 2.175 MbMicrosoft PowerPoint presentation 2.175 Mb
Microsoft PowerPoint presentation 2.175 Mbwebhostingguy
 

More from webhostingguy (20)

File Upload
File UploadFile Upload
File Upload
 
Running and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test FrameworkRunning and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test Framework
 
MySQL and memcached Guide
MySQL and memcached GuideMySQL and memcached Guide
MySQL and memcached Guide
 
Novell® iChain® 2.3
Novell® iChain® 2.3Novell® iChain® 2.3
Novell® iChain® 2.3
 
Load-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web serversLoad-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web servers
 
SQL Server 2008 Consolidation
SQL Server 2008 ConsolidationSQL Server 2008 Consolidation
SQL Server 2008 Consolidation
 
What is mod_perl?
What is mod_perl?What is mod_perl?
What is mod_perl?
 
What is mod_perl?
What is mod_perl?What is mod_perl?
What is mod_perl?
 
Master Service Agreement
Master Service AgreementMaster Service Agreement
Master Service Agreement
 
Notes8
Notes8Notes8
Notes8
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
 
Dell Reference Architecture Guide Deploying Microsoft® SQL ...
Dell Reference Architecture Guide Deploying Microsoft® SQL ...Dell Reference Architecture Guide Deploying Microsoft® SQL ...
Dell Reference Architecture Guide Deploying Microsoft® SQL ...
 
Managing Diverse IT Infrastructure
Managing Diverse IT InfrastructureManaging Diverse IT Infrastructure
Managing Diverse IT Infrastructure
 
Web design for business.ppt
Web design for business.pptWeb design for business.ppt
Web design for business.ppt
 
IT Power Management Strategy
IT Power Management Strategy IT Power Management Strategy
IT Power Management Strategy
 
Excel and SQL Quick Tricks for Merchandisers
Excel and SQL Quick Tricks for MerchandisersExcel and SQL Quick Tricks for Merchandisers
Excel and SQL Quick Tricks for Merchandisers
 
OLUG_xen.ppt
OLUG_xen.pptOLUG_xen.ppt
OLUG_xen.ppt
 
Parallels Hosting Products
Parallels Hosting ProductsParallels Hosting Products
Parallels Hosting Products
 
Microsoft PowerPoint presentation 2.175 Mb
Microsoft PowerPoint presentation 2.175 MbMicrosoft PowerPoint presentation 2.175 Mb
Microsoft PowerPoint presentation 2.175 Mb
 
Reseller's Guide
Reseller's GuideReseller's Guide
Reseller's Guide
 

mySQL and Relational Databases

  • 1. mySQL and Relational Databases By Jeff Smith
  • 2.
  • 3.
  • 4.
  • 5. Table Concepts and Terms -2 Table: PhoneBook Columns or Fields: Company, Address, City, State, Zip, Phone
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.  
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. Common MySQL Commands -3 alter table [table name] drop index [colmn name]; Delete unique from table. alter table [table name] modify [column name] VARCHAR(3); Make a column bigger. alter table [table name] add unique ([column name]); Make a unique column so you get no dupes. alter table [table name] change [old column name] [new column name] varchar (50); Change column name. alter table [table name] add column [new column name] varchar (20); Add a new column to db. alter table [table name] drop column [column name]; Delete a column.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62. MySQL Exercise -2 REGISTRATION ---------------------- REGISTRATION_ID (PK) STUDENT_ID COURSE_ID STUDENT_ID and COURSE_ID should be foreign keys
  • 63.
  • 64.
  • 65.
  • 66.