Creating a database and tables all at once?
Hey guys I'm creating a quick mysql file to create a DB with some tables in it. I seem to remember that I can create the DB and tables all at once without using the USE my_db though?

Here's what I'm using right now.

	 CREATE DATABASE IF NOT EXISTS `preferred_inspections`;
	 USE `preferred_inspections`;

		DROP TABLE IF EXISTS `my_table1`;
		CREATE TABLE `my_table1` (

			`key` 					INT UNSIGNED AUTO_INCREMENT, 

			`role` 					VARCHAR(70), 
			`region` 				VARCHAR(70),
			`inspection_type` 		VARCHAR(70),

			`inspection_number` 	SMALLINT,

			`customer_number` 		VARCHAR(70),

			`report_date` 			DATE DEFAULT NULL,

			PRIMARY KEY(key)
			
		) ENGINE=MyISAM DEFAULT CHARSET=UTF8;

		DROP TABLE IF EXISTS `my_table2`;
		CREATE TABLE `my_table2` (

			`key` 					INT UNSIGNED AUTO_INCREMENT, 

			`role` 					VARCHAR(70), 
			`region` 				VARCHAR(70),
			`inspection_type` 		VARCHAR(70),

			`inspection_number` 	SMALLINT,

			`customer_number` 		VARCHAR(70),

			`report_date` 			DATE DEFAULT NULL,

			PRIMARY KEY(key)
			
		) ENGINE=MyISAM DEFAULT CHARSET=UTF8;

Can't I do something like this though?? I can't seem to remember or find an example....


	 DROP DATABASE IF EXISTS `preferred_inspections`;
	 CREATE DATABASE `preferred_inspections` (

		CREATE TABLE `my_table1` (

			`key` 					INT UNSIGNED AUTO_INCREMENT, 

			`role` 					VARCHAR(70), 
			`region` 				VARCHAR(70),
			`inspection_type` 		VARCHAR(70),

			`inspection_number` 	SMALLINT,

			`customer_number` 		VARCHAR(70),

			`report_date` 			DATE DEFAULT NULL,

			PRIMARY KEY(key)
			
		),

		CREATE TABLE `my_table2` (

			`key` 					INT UNSIGNED AUTO_INCREMENT, 

			`role` 					VARCHAR(70), 
			`region` 				VARCHAR(70),
			`inspection_type` 		VARCHAR(70),

			`inspection_number` 	SMALLINT,

			`customer_number` 		VARCHAR(70),

			`report_date` 			DATE DEFAULT NULL,

			PRIMARY KEY(key)
			
		)

	)	ENGINE=MyISAM DEFAULT CHARSET=UTF8;

Thanks Guys n' Gals
Creating a database and tables all at once?
===

Hey guys I'm creating a quick mysql file to create a DB with some tables in it. I seem to remember that I can create the DB and tables all at once without using the USE my_db though?

Here's what I'm using right now.

	 CREATE DATABASE IF NOT EXISTS `preferred_inspections`;
	 USE `preferred_inspections`;

		DROP TABLE IF EXISTS `my_table1`;
		CREATE TABLE `my_table1` (

			`key` 					INT UNSIGNED AUTO_INCREMENT, 

			`role` 					VARCHAR(70), 
			`region` 				VARCHAR(70),
			`inspection_type` 		VARCHAR(70),

			`inspection_number` 	SMALLINT,

			`customer_number` 		VARCHAR(70),

			`report_date` 			DATE DEFAULT NULL,

			PRIMARY KEY(key)
			
		) ENGINE=MyISAM DEFAULT CHARSET=UTF8;

		DROP TABLE IF EXISTS `my_table2`;
		CREATE TABLE `my_table2` (

			`key` 					INT UNSIGNED AUTO_INCREMENT, 

			`role` 					VARCHAR(70), 
			`region` 				VARCHAR(70),
			`inspection_type` 		VARCHAR(70),

			`inspection_number` 	SMALLINT,

			`customer_number` 		VARCHAR(70),

			`report_date` 			DATE DEFAULT NULL,

			PRIMARY KEY(key)
			
		) ENGINE=MyISAM DEFAULT CHARSET=UTF8;

Can't I do something like this though?? I can't seem to remember or find an example....


	 DROP DATABASE IF EXISTS `preferred_inspections`;
	 CREATE DATABASE `preferred_inspections` (

		CREATE TABLE `my_table1` (

			`key` 					INT UNSIGNED AUTO_INCREMENT, 

			`role` 					VARCHAR(70), 
			`region` 				VARCHAR(70),
			`inspection_type` 		VARCHAR(70),

			`inspection_number` 	SMALLINT,

			`customer_number` 		VARCHAR(70),

			`report_date` 			DATE DEFAULT NULL,

			PRIMARY KEY(key)
			
		),

		CREATE TABLE `my_table2` (

			`key` 					INT UNSIGNED AUTO_INCREMENT, 

			`role` 					VARCHAR(70), 
			`region` 				VARCHAR(70),
			`inspection_type` 		VARCHAR(70),

			`inspection_number` 	SMALLINT,

			`customer_number` 		VARCHAR(70),

			`report_date` 			DATE DEFAULT NULL,

			PRIMARY KEY(key)
			
		)

	)	ENGINE=MyISAM DEFAULT CHARSET=UTF8;

Thanks Guys n' Gals