Wednesday, 15 April 2015

Drop a Table

The drop table command is used to delete a table and all rows in the table. To delete an entire table including all of its rows, issue the drop tablecommand followed by the tablename. drop table is different from deleting all of the records in the table. Deleting all of the records in the table leaves the table including column and constraint information. Dropping the table removes the table definition as well as all of its rows. drop table "tablename" Example: drop table myemployees_ts0211; Drop Table exercises Drop...

Deleting Records

The delete statement is used to delete records or rows from the table. delete from "tablename" where "columnname" OPERATOR "value" [and|or "column" OPERATOR "value"]; [ ] = optional [The above example was line wrapped for better viewing on this Web page.] Examples: delete from employee; Note: if you leave off the where clause, all records will be deleted! delete from employee where lastname = 'May'; delete from employee where firstname = 'Mike' or firstname = 'Eric'; To delete an entire record/row from a table,...

Updating Records

The update statement is used to update or change records that match a specified criteria. This is accomplished by carefully constructing a where clause. update "tablename" set "columnname" = "newvalue" [,"nextcolumn" = "newvalue2"...] where "columnname" OPERATOR "value" [and|or "column" OPERATOR "value"]; [] = optional [The above example was line wrapped for better viewing on this Web page.] Examples: update phone_book set area_code = 623 where prefix = 979; update phone_book set last_name = 'Smith', prefix=555,...

Inserting into a Table

The insert statement is used to insert or add a row of data into the table. To insert records into a table, enter the key words insert into followed by the table name, followed by an open parenthesis, followed by a list of column names separated by commas, followed by a closing parenthesis, followed by the keyword values, followed by the list of values enclosed in parenthesis. The values that you enter will be held in the rows and they will match up with the column names that you specify. Strings should be enclosed in...

Creating Tables

Creating Tables The create table statement is used to create a new table. Here is the format of a simple create table statement: create table "tablename" ("column1" "data type", "column2" "data type", "column3" "data type"); Format of create table if you were to use optional constraints: create table "tablename" ("column1" "data type" [constraint], "column2" "data type" [constraint], "column3" "data type" [constraint]); [ ] = optional Note: You may have as many columns as you'd like,...

Selecting Data

The select statement is used to query the database and retrieve selected data that match the criteria that you specify. Here is the format of a simple select statement: select "column1" [,"column2",etc] from "tablename" [where "condition"]; [] = optional The column names that follow the select keyword determine which columns will be returned in the results. You can select as many column names that you'd like, or you can use a "*" to select all columns. The table name that follows the keyword from specifies the table...

Table Basics

A relational database system contains one or more objects called tables. The data or information for the database are stored in these tables. Tables are uniquely identified by their names and are comprised of columns and rows. Columns contain the column name, data type, and any other attributes for the column. Rows contain the records or data for the columns. Here is a sample table called "weather". city, state, high, and low are the columns. The rows contain the data for this table: Weather citystatehighlow PhoenixArizona10590 TucsonArizona10192 FlagstaffArizona8869 San...

What is SQL?

SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database. According to ANSI (American National Standards Institute), it is the standard language for relational database management systems. SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database. Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc. Although most database systems use SQL, most of them also have their...

Tuesday, 14 April 2015

PHP Useful Resources

If you want to list down your website, book or any other resource on this page then please contact at webmaster@tutorialspoint.com PHP Official Website: - A complete resource for PHP stuff. Starting from latest PHP updates to latest function manual is available at this site. PEAR - PHP Extension and Application Repository, find a list of various useful PHP packages. MySQL Homepage - Here you can download the latest MySQL release, get the MySQL news update. The mailing list is also a great resources for anyone who want to build dynamic websites...

PHP Function Reference

PHP is very rich in terms of Buil-in functions. Here is the list of various important function categories. There are various other function categories which are not covered here. Select a category to see a list of all the functions related to that category. PHP Array Functions PHP Calender Functions PHP Class/Object Functions PHP Character Functions PHP Date & Time Functions PHP Directory Functions PHP Error Handling Functions PHP File System Functions PHP MySQL Functions PHP Network Functions PHP ODBC Functions PHP String Functions PHP...

PHP for PERL Developers

This chapter will list out major similarities and differences in between PHP and PERL. This will help PERL developers to understand PHP very quickly and avoid common mistakes. Similarities: Compiled scripting languages: Both Perl and PHP are scripting languages.This means that they are not used to produce native standalone executables in advance of execution. Syntax: PHP's basic syntax is very close to Perl's, and both share a lot of syntactic features with C. Code is insensitive to whitespace, statements are terminated by semicolons,...

PHP for C Developers

The simplest way to think of PHP is as interpreted C that you can embed in HTML documents. The language itself is a lot like C, except with untyped variables, a whole lot of Web-specific libraries built in, and everything hooked up directly to your favorite Web server. The syntax of statements and function definitions should be familiar, except that variables are always preceded by $, and functions do not require separate prototypes. Here we will put some similarities and diferences in PHP and C Similarities: Syntax: Broadly speaking,...

Object Oriented Programming in PHP

We can imagine our universe made of different objects like sun, earth, moon etc. Similarly we can imagine our car made of different objects like wheel, steering, gear etc. Same way there is object oriented programming concepts which assume everything as an object and implement a software using different objects. Object Oriented Concepts: Before we go in detail, lets define important terms related to Object Oriented Programming. Class: This is a programmer-defined datatype, which includes local functions as well as local data. You can...