Home arrow BrainDump arrow Page 3 - More Advanced SQL Statements

And along came baby - BrainDump

In this third part to a series on beginning SQL, you'll learn how to use SQL statements to manipulate entire tables: to join them, alter them, and even delete them. It's all part of keeping a firm grip on your databases. Keep reading to learn more.

TABLE OF CONTENTS:
  1. More Advanced SQL Statements
  2. UNION STATEMENT
  3. And along came baby
  4. Speeding Up the Search
  5. OOPS I DID IT AGAIN
By: James Payne
Rating: starstarstarstarstar / 23
October 08, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Now that we've wedded some tables in unholy matrimony and made some babies, let's add to our amazing powers and learn the CREATE statement.

With the CREATE statement you can create new tables and even an entirely new database. Before we do however, let's discuss data types.

In short, the data type defines what sort of data a column can hold. If you signify that a field is a date field, and try to enter text into that field, your database will yell at you. Everything has a place, and put the proper things there. And close the door. What, were you born in a barn?

The following table shows the different data types available.

Data Type

Function

CHAR

For character strings with a fixed-length

VARCHAR

For character strings with variable lengths

INT

For integer numbers

Numeric

For holding numbers with decimals

Float

For numbers with floating points

Date

For dates

Time

For times

TIMESTAMP

For dates and times

INTERVAL

For holding time intervals

There are other forms of data types, but they are beyond the scope of this article. For the time being, these should suffice.

So now your boss wants a new database. This one will show the employees' names and how long they have been with the company. We will call this database Seniority. To create the database in SQL, do the following:

 

CREATE DATABASE SENIORITY;

It's just that simple. Or is it? Of course it isn't. We also need a table for our database. So let's create that now.


CREATE TABLE SENIORITY

(

EmployeeName VARCHAR,

YearsEmployed INT

)




 
 
>>> More BrainDump Articles          >>> More By James Payne
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

BRAINDUMP ARTICLES

- Apple Founder Steve Jobs Dies
- Steve Jobs` Era at Apple Ends
- Google's Chrome Developer Tool Updated
- Google's Chrome 6 Browser Brings Speed to th...
- New Open Source Update Fedora 13 is Released...
- Install Linux with Knoppix
- iPad Developers Flock To SDK 3.2
- Managing a Linux Wireless Access Point
- Maintaining a Linux Wireless Access Point
- Securing a Linux Wireless Access Point
- Configuring a Linux Wireless Access Point
- Building a Linux Wireless Access Point
- Migrating Oracle to PostgreSQL with Enterpri...
- Demystifying SELinux on Kernel 2.6
- Yahoo and Microsoft Create Ad Partnership

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: