Help With Sql Syntax it keeps giving me error plz Help

qasim173's profile image qasim173 posted 2 years ago in Running SQL scripts Permalink

Can someone help me with the sql query

dealership was unable to execute a query! You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS dealership_hired_players (dealership_id V...' at line 16

THE SQL IS BELOW:

CREATE TABLE IF NOT EXISTS `dealership_balance` (
                `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                `dealership_id` VARCHAR(50) NOT NULL COLLATE 'latin1_swedish_ci',
                `user_id` VARCHAR(50) NOT NULL COLLATE 'latin1_swedish_ci',
                `description` VARCHAR(255) NOT NULL COLLATE 'latin1_swedish_ci',
                `name` VARCHAR(50) NOT NULL COLLATE 'latin1_swedish_ci',
                `amount` INT(11) UNSIGNED NOT NULL,
                `type` BIT(1) NOT NULL COMMENT '0 = income | 1 = expense',
                `isbuy` BIT(1) NOT NULL,
                `date` INT(11) UNSIGNED NOT NULL,
                PRIMARY KEY (`id`) USING BTREE
            )
            COLLATE='latin1_swedish_ci'
            ENGINE=InnoDB;          

            CREATE TABLE IF NOT EXISTS `dealership_hired_players` (
                `dealership_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `user_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `profile_img` VARCHAR(255) NOT NULL ,
                `banner_img` VARCHAR(255) NOT NULL,
                `name` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `jobs_done` INT(11) UNSIGNED NOT NULL DEFAULT '0',
                `timer` INT(11) UNSIGNED NOT NULL,
                PRIMARY KEY (`dealership_id`, `user_id`) USING BTREE
            )
            COLLATE='utf8mb4_general_ci'
            ENGINE=InnoDB;


            CREATE TABLE IF NOT EXISTS `dealership_owner` (
                `dealership_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `user_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `name` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `profile_img` VARCHAR(255) NOT NULL ,
                `banner_img` VARCHAR(255) NOT NULL,
                `stock` TEXT NOT NULL COLLATE 'utf8mb4_general_ci',
                `stock_prices` LONGTEXT NOT NULL COLLATE 'utf8mb4_general_ci',
                `stock_sold` TEXT NOT NULL COLLATE 'utf8mb4_unicode_ci',
                `money` INT(11) UNSIGNED NOT NULL DEFAULT '0',
                `total_money_spent` INT(11) UNSIGNED NOT NULL DEFAULT '0',
                `total_money_earned` INT(11) UNSIGNED NOT NULL DEFAULT '0',
                `timer` INT(11) UNSIGNED NOT NULL,
                PRIMARY KEY (`dealership_id`) USING BTREE
            )
            COLLATE='utf8mb4_general_ci'
            ENGINE=InnoDB;          

            CREATE TABLE IF NOT EXISTS `dealership_requests` (
                `id` INT(11) NOT NULL AUTO_INCREMENT,
                `dealership_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `user_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `vehicle` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `plate` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `request_type` INT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0 = sell reques t| 1 = buy request',
                `name` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
                `price` INT(11) UNSIGNED NOT NULL,
                `status` INT(2) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0 = waiting | 1 = in progress | 2 = finished | 3 = cancelled',
                PRIMARY KEY (`id`) USING BTREE,
                UNIQUE INDEX `request` (`user_id`, `vehicle`, `request_type`, `plate`) USING BTREE
            )
            COLLATE='utf8mb4_general_ci'
            ENGINE=InnoDB;          

            CREATE TABLE IF NOT EXISTS `dealership_stock` (
                `vehicle` VARCHAR(100) NOT NULL COLLATE 'latin1_swedish_ci',
                `amount` INT(11) UNSIGNED NOT NULL DEFAULT '0',
                PRIMARY KEY (`vehicle`) USING BTREE
            )
            COLLATE='latin1_swedish_ci'
            ENGINE=InnoDB;
ansgar's profile image ansgar posted 2 years ago Permalink

Queries run fine here on MariaDB 10.3.

Did you probably change the query delimiter? Should match the semicolon from your code.

Description

Please login to leave a reply, or register at first.