0% found this document useful (0 votes)
14 views14 pages

MySQL vs MS SQL Command Differences

The document compares commands for creating and manipulating databases and tables between MySQL and MS SQL. Key differences noted are in showing databases, declaring foreign keys, handling ENUM types, and auto-incrementing values. The document provides code examples of corresponding commands for common tasks in both MySQL and MS SQL.

Uploaded by

Neil John
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views14 pages

MySQL vs MS SQL Command Differences

The document compares commands for creating and manipulating databases and tables between MySQL and MS SQL. Key differences noted are in showing databases, declaring foreign keys, handling ENUM types, and auto-incrementing values. The document provides code examples of corresponding commands for common tasks in both MySQL and MS SQL.

Uploaded by

Neil John
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name: Neil John Leong

Course & Section: BSIT-MWA | INF222

MySQL and MS SQL


Command Differences

Lesson 6: Database & Table Creation

Showing Database

- MySQL and MS SQL use different prompt for showing databases.


In showing databases, MySQL uses the prompt “SHOW
DATABASES;”, while MS SQL use the “SELECT name FROM
[Link];”

MySQL:

MS SQL:

Creating Database
- MySQL and MS SQL both uses “CREATE DATABASE db_name” when
creating a new database.

MySQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

MS SQL:

Using database
- The prompt for using a database in MySQL and MS SQL is the
same
MySQL:

MS SQL:

Deleting a database:
- In deleting a database, both uses the prompt “DROP DATABASE
db_name”
MySQL:

MS SQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

Creating a Table
- Creating a table is the same for MySQL and MS SQL
MySQL:

MS SQL:

Lesson 7 – Data Manipulation


Inserting data
- In inserting data, MySQL and MS SQL uses the same command
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

MySQL:

MS SQL:

Updating Data
- MySQL and MS SQL both uses same command in updating a data
MySQL:

MS SQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

Deleting Data
- Both MySQL and MS SQL have the same command when deleting a
record
MySQL:

MS SQL:

Select (Showing Final Table)


MySQL:

MS SQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

Lesson 8 – Table Constraints


Using NOT NULL constraint
- MySQL and MS SQL both uses the keyword NOT NULL when
constraining a data in order to avoid entering a NULL value.
MySQL:

MS SQL:

Using Unique Constraint


- MySQL and MS SQL both uses the keyword UNIQUE when
constraining a data to make a value unique
MySQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

MS SQL:

Primary Key
- Primary key is similar to not null and unique combined
together and they have the same command for both MySQL and MS
SQL
MySQL:

MS SQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

Foreign Key
- In foreign key, there is a slight difference in declaring the
foreign key for MySQL and MS SQL
MySQL:

MS SQL:

Default Value
- MySQL and MS SQL has the same command when returning a default
value
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222
MySQL:

MS SQL:

Check
- The check constraints has different approach for MySQL and MS
SQL. You can put it inline or use the constraint keyword. For
my case, I used the constraint keyword.
MySQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

MS SQL:

ENUM
- ENUM is not supported in MS SQL so we need to find a workaround
to make similar effect to ENUM
MySQL:

MS SQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

Auto Increment
- MySQL and MS SQL have different approach when auto
incrementing a value. MySQL uses AUTO_INCREMENT while MS SQL
uses IDENTITY.
MySQL:

MS SQL:

Table Structure and output


MySQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

MS SQL:

Lesson 9 – Table Manipulation

Adding a column in table


- MySQL and MS SQL uses the same command when adding a column
in table
MySQL:

MS SQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

Dropping a column
- MySQL and MS SQL both uses the same prompt when dropping a
column in table
MySQL:

MS SQL:

Renaming Column in table


- There are different approach in changing the column name in
MySQL and MS SQL
MySQL:

MS SQL:
Name: Neil John Leong
Course & Section: BSIT-MWA | INF222

Modify Column in table


- MySQL and MS SQL have different approach when modifying a
column data type
MySQL:

MS SQL:

Rename Table
- In renaming table MySQL and MS SQL have different command to
rename the table
MySQL:

MS SQL:

You might also like