Z
Z
Zangar2016-09-12 12:38:47
PHP
Zangar, 2016-09-12 12:38:47

How to build a database correctly?

I have a MySQL database that has a companies table. prntscr.com/ch1okn
I can’t think of, and indeed do so, that: prntscr.com/ch1t3q
The user selects a company from the drop-down list, fills out an application (order) and sets the status (completed / not completed), the button (DONE) will update last_order from the companies table by returning the current date
the query to create the companies itself

CREATE TABLE IF NOT EXISTS `companies` (
  `numbr` int(11) DEFAULT NULL,
  `compname` varchar(255) NOT NULL DEFAULT '',
  `phone_main` varchar(255) DEFAULT NULL,
  `phone_extra` varchar(255) DEFAULT NULL,
  `adress` varchar(255) DEFAULT NULL,
  `last_order` date(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `companies`
  ADD PRIMARY KEY (`compname`),
  ADD KEY `compname` (`compname`);

Thanks

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question