PROGRAMMING

 
REMEMBERS




Last update:   29-10-2021

Keyword example

In both table page_id (key) must be same type.
 
CREATE TABLE `keyword` (
  `page_id` int(11) unsigned NOT NULL,
  `keyword` varchar(100) NOT NULL,
  `total` int(10) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`page_id`, `keyword`)
) 

CREATE TABLE `keyword_log` (
  `page_id` int(11) unsigned NOT NULL,
  `keyword` varchar(100) NOT NULL,
  `ip` varchar(15) NOT NULL,
  UNIQUE KEY `page_id` (`page_id`,`keyword`)
)
... 7 lines
 
More simple than using ON keyword.page_id = keyword_log.page_id
 
SELECT *  FROM keyword 
  INNER JOIN keyword_log 
    USING (page_id)

Questions    
Substring

        A B C D E F
🔔
1/1