Web Hosting Talk







View Full Version : Help in sql queries and insert command


zedthrone
11-09-2008, 11:46 PM
Hello,
I am trying to create a database that will add persons details to the database.
I had created this database structure.
QUOTE
CREATE TABLE country (
id int(10) unsigned NOT NULL auto_increment,
name varchar(50) default NULL,
code varchar(4) default NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE registration (
id int(10) unsigned NOT NULL auto_increment,
registration_number int(10) unsigned default NULL,
name varchar(100) default NULL,
country_id int(10) unsigned default NULL,
state_id int(10) unsigned default NULL,
city varchar(50) default NULL,
address varchar(75) default NULL,
practice_place varchar(155) default NULL,
fathers_name varchar(100) default NULL,
birthday date default NULL,
age tinyint(3) unsigned default NULL,
degree enum('bams','bums','md','phd') default NULL,
institution varchar(100) default NULL,
passing_year int(11) default NULL,
registration_status enum('granted','pending','expired') default NULL,
photo longblob,
grant_start date default NULL,
grant_end date default NULL,
PRIMARY KEY (id),
KEY country (country_id,state_id)
) ENGINE=InnoDB;
CREATE TABLE state (
id int(10) unsigned NOT NULL auto_increment,
country_id int(10) unsigned NOT NULL,
name varchar(50) default NULL,
PRIMARY KEY (id),
KEY country_id (country_id)
) ENGINE=InnoDB;
ALTER TABLE state
ADD CONSTRAINT state_ibfk_1 FOREIGN KEY (country_id) REFERENCES country (id) ON DELETE CASCADE ON UPDATE NO ACTION;
Thanks in advance for anybody who can help me to complete this database by creating insert commands and queries.
Zed

Jaseeey
11-10-2008, 04:33 AM
Have you considered using phpMyAdmin on the server to access the database?

zedthrone
11-10-2008, 07:00 AM
I need queries to run this structure...

Jaseeey
11-10-2008, 07:51 AM
phpMyAdmin can give you an output of the queries it uses.