I know I am missing alot, but I am new to mysql and I have to make a table for a used car dealer which includes make,model,price and mpg and I am confused. I have to configure commands with sample data to enter at least one record in each field.


CREATE TABLE cars (
id INT NOT NULL AUTO INCREMENT,
maketext TEXT,
modeltext TEXT,
price
mpg
...
);

Refer This Sample....

CREATE TABLE IF NOT EXISTS `sample` (
  `NAME` varchar(100) NOT NULL,
  `AGE` int(2) NOT NULL,
  `ADDRESS` text NOT NULL,
  PRIMARY KEY (`NAME`)
);
--
-- Dumping data for table `sample`
--

INSERT INTO `sample` (`NAME`, `AGE`, `ADDRESS`) VALUES
('Ankit', 25, 'Chennai');

hi
i think rajarajan07 is writ you refear the chapter properly

beacuse your syntax is not write you refear www.w3cschool.com it is for you

As we know that MySql act as Database System and we need " Structured Query Language " For Accessing it, and as you mention that not a single column be empty, when anyone insert data in them, fro that we use Constraints Concept,like

CREATE TABLE IF NOT EXISTS Table_Name(NAME VARCHAR(25) NOT NULL,AGE INT(3) NOT NULL,
ADDRESS TEXT NOT NULL, PRIMARY KEY (NAME));

See that Query Carefully, Because here I use Constraints But I don't mention the name for that, then What wrong with me? Nothing Wrong with me.
Because here System automatically insert Constraints Name, but I also have an authority for specifying Constraints name.

Now we Insert one data at one time:
INSERT INTO Table_Name(NAME,AGE,ADDRESS)VALUES("Pradeep", 28,"India");

Now we Insert suppose 4 data at one time??:then we use that Query

INSERT INTO Table_Name(NAME,AGE,ADDRESS)VALUES("Pradeep", 28, "India");
INSERT INTO Table_Name(NAME,AGE,ADDRESS)VALUES("Kuldeep", 23, "India");
INSERT INTO Table_Name(NAME,AGE,ADDRESS)VALUES("Deepak" , 22, "India");
INSERT INTO Table_Name(NAME,AGE,ADDRESS)VALUES("Sandeep", 21, "India");

But that's not so Good, Now we have an Excellent Alternative For that
See Them


INSERT INTO Table_Name(NAME,AGE,ADDRESS)VALUES("Pradeep", 28, "India"),
("Kuldeep", 23, "India"),("Deepak" , 22, "India"),("Sandeep", 21, "India");

Take Enjoy With that Knowledge, and still you have any little bit doubt then just, mention here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.