Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Getting Started with MariaDB

You're reading from   Getting Started with MariaDB Explore the powerful features of MariaDB with practical examples

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781785284120
Length 140 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Daniel Bartholomew Daniel Bartholomew
Author Profile Icon Daniel Bartholomew
Daniel Bartholomew
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Getting Started with MariaDB Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Installing MariaDB FREE CHAPTER 2. Configuring MariaDB 3. Securing MariaDB 4. Administering MariaDB 5. Using MariaDB – Databases and Tables 6. Using MariaDB – Inserting, Updating, and Deleting 7. Using MariaDB – Retrieving Data 8. Maintaining MariaDB MariaDB Next Steps
Index

Creating, altering, and dropping tables


Now that we know a little about how data is structured in a database, we can learn more about creating our own tables, making changes to them, and even how to delete them.

Using CREATE TABLE

We use the CREATE TABLE command to create tables. For a basic database for an online store, we might have tables for customers, products, orders, product reviews, customer addresses, and more. We can create as many tables as we need, but as mentioned previously, we should give the design some thought so that we don't store duplicate or unused data. That said, don't worry about this too much, as we can always make changes later with the ALTER TABLE command (see the Using ALTER TABLE section later in this chapter).

Using CREATE TABLE – basic syntax

The basic syntax of the CREATE TABLE command is as follows:

CREATE TABLE table_name (<column_definitions>);

As with creating a database, we can add an IF NOT EXISTS command before the table name to suppress the error...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime
Visually different images