PHP is open source scripting language. It\'s widely used to develop web applications.  Home Web Programming PHP Introduction to SQL
Your Ad Here

Introduction to SQL


Update

We can change the information in existing rows in the database using the UPDATE statement.

UPDATE people SET location = 'Ohio' WHERE name = 'Jill'

Update the table people and change the location to Ohio WHERE the name is Jill.We could update more than one column field if we wanted.

UPDATE people SET location = 'Ohio', age = '25' WHERE name = 'Jill'

Just separate them with commas.

Create

We can use the CREATE TABLE statement to make new tables.

CREATE TABLE other_people( id INTEGER (11), name VARCHAR (255), gender VARCHAR (6), location VARCHAR (255), age INTEGER (3) )

Create a table named other_people, now we have to define each column field and the type of data it will contain, here is a list of some of them:

  • INTEGER - A whole number.
  • VARCHAR (10) - Up to 10 characters.
  • CHAR (10) - Only 10 characters.
  • DATE - A date.
  • DATETIME - Date and time.
  • FLOAT - Floating point numbers.

Read the SQL statement, it speaks for itself.

Drop

We can delete tables from our database with the DROP TABLE statement.

DROP TABLE other_people

It's as simple as that.

Conclusion

That about wraps up this introduction to SQL. This is the extreme basics, but it's these foundations you need so you can build on them and advance your skills in SQL.


Author's URL: allsyntax.com
Thank you for voting. Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Web programming � everything from the basics of visual design and architecture to the specifics of applications, graphics, and scripting. More Web Programming: Most Popular Materials | Fresh Materials | More PHP Tutorials at LearnPHP.org

Add comments to "Introduction to SQL"

Only registered users can write comment

No comments yet...