Community management

Create a php sql table

Above all, you should know that the Structured Query Language or SQL is a query language that allows you to make queries or queries on a database management system or SGBD. A database table has a unique name and is generally composed by columns and rows. If you are a custom php application development user, here's how to create a table in SQL with PHP.

The table liste_owner

Let us first create the table is liste_owner table_liste_owner.sql.

CREATE TABLE liste_owner (
number INT (5) NOT NULL,
name varchar (20) NOT NULL,
phone varchar (14) NOT NULL
) TYPE = MyISAM; .

Here we then create a liste_owner table that contains three attributes including the number which will correspond to an integer (INT) 5 digits, a name that corresponds to a esuite character (VARCHAR) of 20 characters and phone that will match a character string (VARCHAR) of 14 characters.

VARCHAR is used here to strings that can contain both text and numbers. For any attribute can not be empty, we have NOT NULL for all. The type MyISAM, meanwhile, has the role to clarify that we are here dealing with a MySQL database.

The table liste_disque

The table_liste_disque.sql will be composed by

CREATE TABLE liste_disque (
number INT (5) NOT NULL,
author varchar (50) NOT NULL,
title varchar (50) NOT NULL,
) TYPE = MyISAM.

The attributes are almost identical as that of the first table. However we have been able to use the extra AUTO_INCREMENT number for attributes in the first table. This will then prevent us each time specify the new owner of the number. This extra will thus enable us to automatically increment each time you insert a new owner.

The table liste_owner will be defined as follows:

CREATE TABLE liste_owner (
number INT (5) NOT NULL AUTO_INCREMENT,
name varchar (20) NOT NULL,
VARCHART phone (14) NOT NULL,
PRIMARY KEY (number)
) TYPE = MyISAM;

Here PRIMARY KEY (number) will indicate the number attribute. It is then possible for us to identify all tuples of the table from him.

The creation of this table is from PHPMyAdmin. However, it is also possible to do it directly from a php page but this is not ideal for beginners.

Share your mind with us !

Les publications similaires de "Blog"

  1. 2 Fév. 20227,000-Euro Kadena Mining Machine: Goldshell KD-BOX360 vues
  2. 4 Janv. 2022This Country Has the Largest Number of Professional PHP Developers418 vues
  3. 28 Nov. 20216 Things Entrepreneurs Should Know About Team Extension666 vues
  4. 13 Juil. 2021Do marketing and development are related ?871 vues
  5. 30 Mars 2021How can you insert a basket for an ecommerce ?1277 vues
  6. 27 Fév. 2021Is Laravel ruling web development?1261 vues
  7. 13 Nov. 2020A Php company for all your needs1522 vues
  8. 30 Oct. 2020The right Php development company who can use the right programming languages to build successful we1287 vues
  9. 30 Sept. 2020Working with a highly recommended Php development team1226 vues
  10. 28 Août 2020Top performing Php Programmers @SimplyPhp.com1010 vues
  11. 24 Août 2020Hire the right Php programmer with SimplyPhp892 vues
  12. 15 Juil. 2020Producung your photo book online1420 vues
  13. 29 Mai 2020Top Php programming with SimplyPhp1143 vues
  14. 30 Avril 2020What Php programmers can bring to your project1068 vues
  15. 27 Mars 2020How to cope with php bugs ?1202 vues