Új hozzászólás Aktív témák

  • biker

    nagyúr

    egy más által félbehagyott szart kell felélesszek, és valamit nem értek

    1: Előbb létrehoz két view táblát:

    CREATE TABLE IF NOT EXISTS `country_views` (
    `id` smallint(6)
    ,`countryName` varchar(50)
    ,`countryCode` varchar(2)
    ,`ISO2` varchar(2)
    ,`ISO3` varchar(3)
    ,`ISON` varchar(4)
    ,`Internet` varchar(2)
    ,`Capital` varchar(25)
    ,`MapReference` varchar(50)
    ,`NationalitySingular` varchar(35)
    ,`NationalityPlural` varchar(35)
    ,`Currency` varchar(30)
    ,`CurrencyCode` varchar(3)
    ,`Population` bigint(20)
    ,`Title` varchar(50)
    ,`Comment` varchar(255)
    ,`id_code` varchar(9)
    );

    CREATE TABLE IF NOT EXISTS `view_p_files` (
    `user_id` int(11)
    ,`id` int(11)
    ,`order_id` int(11)
    ,`file_id` int(11)
    ,`quantity` smallint(6)
    ,`amount` double(7,2)
    ,`download_count` smallint(6)
    ,`created` datetime
    ,`modified` datetime
    );

    Majd utána ezt (emiatt nem is fut le az import, nincs jogom ilyen futtatásra)

    --
    -- Structure for view `country_views`
    --
    DROP TABLE IF EXISTS `country_views`;

    CREATE ALGORITHM=UNDEFINED DEFINER=`sausuman`@`localhost` SQL SECURITY DEFINER VIEW `country_views` AS (select `countries`.`id` AS `id`,`countries`.`countryName` AS `countryName`,`countries`.`countryCode` AS `countryCode`,`countries`.`ISO2` AS `ISO2`,`countries`.`ISO3` AS `ISO3`,`countries`.`ISON` AS `ISON`,`countries`.`Internet` AS `Internet`,`countries`.`Capital` AS `Capital`,`countries`.`MapReference` AS `MapReference`,`countries`.`NationalitySingular` AS `NationalitySingular`,`countries`.`NationalityPlural` AS `NationalityPlural`,`countries`.`Currency` AS `Currency`,`countries`.`CurrencyCode` AS `CurrencyCode`,`countries`.`Population` AS `Population`,`countries`.`Title` AS `Title`,`countries`.`Comment` AS `Comment`,concat(`countries`.`id`,'_',`countries`.`countryCode`) AS `id_code` from `countries`);

    -- --------------------------------------------------------

    --
    -- Structure for view `view_p_files`
    --
    DROP TABLE IF EXISTS `view_p_files`;

    CREATE ALGORITHM=UNDEFINED DEFINER=`sausuman`@`localhost` SQL SECURITY DEFINER VIEW `view_p_files` AS select `orders`.`user_id` AS `user_id`,`order_details`.`id` AS `id`,`order_details`.`order_id` AS `order_id`,`order_details`.`file_id` AS `file_id`,`order_details`.`quantity` AS `quantity`,`order_details`.`amount` AS `amount`,`order_details`.`download_count` AS `download_count`,`order_details`.`created` AS `created`,`order_details`.`modified` AS `modified` from (`order_details` join `orders`) where (`orders`.`id` = `order_details`.`order_id`);

    Ez mire jó?

    2: mire jó, ha van 32 táblám, és abból 27db innodb, 5db myisam? Így sikerült, vagy lehet valami nagyon jó indoka rá?

Új hozzászólás Aktív témák

Hirdetés