۱۵-آبان-۱۳۹۲, ۱۹:۳۱:۲۳
سلام دوستان
توی یک بانک اطلاعاتی Mysql کد های زیر برای ساخت یک جدول است.این جداول با هم ارتباط دارند ؟؟؟؟؟؟؟
جدول اول :جدول دوم :جدول سوم :چنتا سوال در مورد کلید ها داشتم، PRIMARY KEY رو بلدم ولی اون KEYهایی که بعد از PRIMARY KEY می نویسند چین؟ایندکس هستند؟
UNIQUE KEY چیه؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟
همچنین AUTO_INCREMENT=496 چیه؟؟
ممنـــــــــــــــــــــون
توی یک بانک اطلاعاتی Mysql کد های زیر برای ساخت یک جدول است.این جداول با هم ارتباط دارند ؟؟؟؟؟؟؟
جدول اول :
کد:
CREATE TABLE IF NOT EXISTS `xeon_ads` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`user_id` mediumint(8) unsigned NOT NULL,
`value` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ad_premium` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`ad_investor` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`ad_uroelite` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`ad_url` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`ad_opis` varchar(150) COLLATE utf8_bin NOT NULL DEFAULT '',
`ad_opis2` varchar(200) COLLATE utf8_bin NOT NULL DEFAULT '',
`ad_cat` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ad_status` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ad_clicks` mediumint(8) unsigned NOT NULL DEFAULT '0',
`ad_active` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`ad_clicksleft` mediumint(8) unsigned NOT NULL DEFAULT '0',
`ad_outside` mediumint(8) unsigned NOT NULL DEFAULT '0',
`ad_expired` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `ad_clicksleft` (`ad_clicksleft`),
KEY `ad_active` (`ad_active`),
KEY `ad_status` (`ad_status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=496 ;
کد:
CREATE TABLE IF NOT EXISTS `xeon_users` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`x_status` varchar(3) COLLATE utf8_bin NOT NULL DEFAULT '0|0',
`x_warnings` tinyint(2) unsigned NOT NULL DEFAULT '0',
`x_username` varchar(20) COLLATE utf8_bin NOT NULL,
`x_username_2` varchar(10) COLLATE utf8_bin NOT NULL,
`x_password` varchar(40) COLLATE utf8_bin NOT NULL,
`x_password_secondary` varchar(255) COLLATE utf8_bin NOT NULL,
`x_password_secondary_status` tinyint(1) NOT NULL DEFAULT '0',
`x_bank_shaba_number` varchar(50) COLLATE utf8_bin DEFAULT NULL,
`x_bank_account_number` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`x_parspal` varchar(10) COLLATE utf8_bin DEFAULT NULL,
`x_bank_name` varchar(32) COLLATE utf8_bin DEFAULT NULL,
`x_your_name` varchar(60) COLLATE utf8_bin DEFAULT NULL,
`x_come` varchar(70) COLLATE utf8_bin NOT NULL,
`x_register` int(10) NOT NULL,
`x_year` smallint(4) unsigned NOT NULL,
`x_ip` varchar(40) COLLATE utf8_bin NOT NULL,
`x_personal` varchar(100) COLLATE utf8_bin NOT NULL,
`x_personal_verify` tinyint(1) unsigned NOT NULL DEFAULT '0',
`x_personal_verify_code` varchar(255) COLLATE utf8_bin NOT NULL,
`b_main` int(12) NOT NULL DEFAULT '0',
`b_rent` int(12) NOT NULL DEFAULT '0',
`b_clicks` smallint(5) unsigned NOT NULL DEFAULT '0',
`b_clicks_mini` smallint(5) unsigned NOT NULL DEFAULT '0',
`b_clicks_tiny` mediumint(8) unsigned NOT NULL DEFAULT '0',
`b_plans` smallint(6) unsigned NOT NULL DEFAULT '0',
`b_link` smallint(8) NOT NULL DEFAULT '0',
`b_signs_mini` smallint(8) NOT NULL DEFAULT '0',
`b_signs` smallint(8) NOT NULL DEFAULT '0',
`s_avg` decimal(12,3) NOT NULL DEFAULT '0.000',
`s_clicks` smallint(5) unsigned NOT NULL DEFAULT '0',
`s_clicks_referrals_direct` int(11) NOT NULL DEFAULT '0',
`s_clicks_referrals_direct_avg` decimal(12,3) NOT NULL DEFAULT '0.000',
`s_clicks_referrals_direct_date` int(10) NOT NULL DEFAULT '0',
`s_clicks_refs` mediumint(8) unsigned NOT NULL DEFAULT '0',
`s_clicks_last` int(10) unsigned NOT NULL DEFAULT '0',
`s_paid` int(12) NOT NULL DEFAULT '0',
`s_invest` int(12) NOT NULL DEFAULT '0',
`s_referals_direct` smallint(5) unsigned NOT NULL DEFAULT '0',
`s_referals_direct_limit` smallint(5) unsigned NOT NULL DEFAULT '20',
`s_referals_rented` smallint(5) unsigned NOT NULL DEFAULT '0',
`s_referals_rented_limit` smallint(5) unsigned NOT NULL DEFAULT '2000',
`r_last_rent` int(10) NOT NULL DEFAULT '0',
`r_referer` varchar(20) COLLATE utf8_bin NOT NULL,
`r_r_rent` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`e_account` varchar(12) COLLATE utf8_bin NOT NULL DEFAULT '0:0',
`e_payment` varchar(100) COLLATE utf8_bin NOT NULL DEFAULT '0:604800:3',
`e_stats` varchar(13) COLLATE utf8_bin NOT NULL DEFAULT '0:0:0:0:0:0:0',
`in_vacation` int(3) NOT NULL DEFAULT '0',
`in_vacation_dat` text COLLATE utf8_bin NOT NULL,
`sesja` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '0',
`sesja_ip` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '0',
`session_id` varchar(255) COLLATE utf8_bin NOT NULL,
`session_ip` varchar(255) COLLATE utf8_bin NOT NULL,
`session_agent` varchar(255) COLLATE utf8_bin NOT NULL,
`session_start` int(10) unsigned NOT NULL DEFAULT '0',
`session_end` int(10) unsigned NOT NULL DEFAULT '0',
`config_acc_changes` tinyint(1) unsigned NOT NULL DEFAULT '0',
`config_acc_news` varchar(3) COLLATE utf8_bin NOT NULL DEFAULT '1;1',
`config_stats_show` varchar(20) COLLATE utf8_bin NOT NULL DEFAULT '1,1,0,0,0,0,1',
`config_update_stats` tinyint(1) unsigned NOT NULL DEFAULT '1',
`config_autopay` varchar(3) COLLATE utf8_bin NOT NULL DEFAULT 'aON',
`config_autorec` varchar(3) COLLATE utf8_bin NOT NULL DEFAULT 'rOF',
`config_forum_access` tinyint(1) unsigned NOT NULL DEFAULT '0',
`config_forum_stats` tinyint(1) unsigned NOT NULL DEFAULT '0',
`config_forum_avator` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT 'http://i28.tinypic.com/1zg5h5j.gif;150px;150px;',
`config_forum_posts` smallint(5) unsigned NOT NULL DEFAULT '0',
`config_forum_thumbs` int(11) NOT NULL DEFAULT '0',
`config_forum_moder` smallint(1) unsigned NOT NULL DEFAULT '0',
`config_forum_from` smallint(3) unsigned NOT NULL DEFAULT '30',
`config_forum_livein` varchar(25) COLLATE utf8_bin NOT NULL,
`config_forum_hobby` varchar(25) COLLATE utf8_bin NOT NULL,
`config_forum_sex` varchar(1) COLLATE utf8_bin NOT NULL,
`config_forum_age` tinyint(2) unsigned NOT NULL DEFAULT '0',
`config_username` tinyint(1) unsigned NOT NULL DEFAULT '0',
`config_pm` tinyint(1) NOT NULL DEFAULT '0',
`config_pm_new` smallint(6) NOT NULL DEFAULT '0',
`config_pm_limit` smallint(5) unsigned NOT NULL DEFAULT '0',
`config_forum_active` int(11) NOT NULL DEFAULT '0',
`config_forum_active_on` tinyint(3) NOT NULL DEFAULT '0',
`config_xeon_avg_force` tinyint(1) unsigned NOT NULL DEFAULT '0',
`config_xeon_avg_cur` decimal(12,3) NOT NULL DEFAULT '0.000',
`config_xeon_avg_cur_amount` smallint(5) unsigned NOT NULL DEFAULT '0',
`config_xeon_avg_min` decimal(12,3) NOT NULL DEFAULT '0.000',
`config_xeon_avg_max` decimal(12,3) NOT NULL DEFAULT '0.000',
`config_xeon_direct_avg_force` tinyint(1) unsigned NOT NULL DEFAULT '0',
`config_xeon_direct_avg_cur` decimal(12,3) NOT NULL DEFAULT '0.000',
`config_xeon_direct_avg_cur_amount` smallint(5) unsigned NOT NULL DEFAULT '0',
`config_xeon_direct_avg_min` decimal(12,3) NOT NULL DEFAULT '0.000',
`config_xeon_direct_avg_max` decimal(12,3) NOT NULL DEFAULT '0.000',
`config_xeon_direct_avg_do_clicks` smallint(5) unsigned NOT NULL DEFAULT '0',
`config_xeon_direct_avg_ma_clicks` smallint(5) NOT NULL DEFAULT '0',
`config_rented_list_avg_range_status` tinyint(1) NOT NULL DEFAULT '1',
`config_rented_list_avg_range` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '1.4|3.2',
`config_rented_list_fliter_days` tinyint(1) NOT NULL DEFAULT '0',
`config_rented_list_fliter_days_val` tinyint(2) NOT NULL DEFAULT '3',
`config_rented_list_fliter_avg` tinyint(1) NOT NULL DEFAULT '0',
`config_rented_list_fliter_avg_val` decimal(12,1) NOT NULL DEFAULT '2.5',
PRIMARY KEY (`id`),
UNIQUE KEY `x_username` (`x_username`),
UNIQUE KEY `x_username_2` (`x_username_2`),
UNIQUE KEY `x_personal` (`x_personal`),
UNIQUE KEY `x_bank_account_number` (`x_bank_shaba_number`),
KEY `r_referer` (`r_referer`),
KEY `x_password` (`x_password`),
KEY `session_id` (`session_id`),
KEY `x_ip` (`x_ip`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3447 ;
کد:
CREATE TABLE IF NOT EXISTS `xeon_ads` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`user_id` mediumint(8) unsigned NOT NULL,
`value` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ad_premium` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`ad_investor` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`ad_uroelite` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`ad_url` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`ad_opis` varchar(150) COLLATE utf8_bin NOT NULL DEFAULT '',
`ad_opis2` varchar(200) COLLATE utf8_bin NOT NULL DEFAULT '',
`ad_cat` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ad_status` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ad_clicks` mediumint(8) unsigned NOT NULL DEFAULT '0',
`ad_active` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
`ad_clicksleft` mediumint(8) unsigned NOT NULL DEFAULT '0',
`ad_outside` mediumint(8) unsigned NOT NULL DEFAULT '0',
`ad_expired` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `ad_clicksleft` (`ad_clicksleft`),
KEY `ad_active` (`ad_active`),
KEY `ad_status` (`ad_status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=496 ;
UNIQUE KEY چیه؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟
همچنین AUTO_INCREMENT=496 چیه؟؟
ممنـــــــــــــــــــــون