Skip to content

Instantly share code, notes, and snippets.

@ZenCocoon
Created November 13, 2011 23:56
Show Gist options
  • Select an option

  • Save ZenCocoon/1362938 to your computer and use it in GitHub Desktop.

Select an option

Save ZenCocoon/1362938 to your computer and use it in GitHub Desktop.
-- How to get all queries that has not been used by the site id 1 ?
DROP TABLE IF EXISTS `queries`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `queries` (
`id` int(11) NOT NULL auto_increment,
`created_at` datetime default NULL,
`updated_at` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `sites`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `sites` (
`id` int(11) NOT NULL auto_increment,
`created_at` datetime default NULL,
`updated_at` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `sites_queries`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `sites_queries` (
`id` int(11) NOT NULL auto_increment,
`site_id` int(11) NOT NULL,
`query_id` int(11) NOT NULL,
`created_at` datetime default NULL,
`updated_at` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment