IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Requêtes MySQL Discussion :

Problème dans une création de tables


Sujet :

Requêtes MySQL

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Expert sécurité informatique
    Inscrit en
    Juillet 2020
    Messages
    142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Expert sécurité informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 142
    Par défaut Problème dans une création de tables
    Bonjour à tous,

    j'ai un petit soucis je n'arrive pas crée une table sur mariaDB voici la table en question :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    CREATE TABLE 'natu_catalog_product_index_eav_decimal_replica' (
      'entity_id' int(10) unsigned NOT NULL COMMENT 'Entity ID',
    'attribute_id' smallint(5) unsigned NOT NULL COMMENT 'Attribute ID',
    'store_id' smallint(5) unsigned NOT NULL COMMENT 'Store ID',
    'value' decimal(12,4) NOT NULL COMMENT 'Value',
    'source_id' int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Original entity Id for attribute
    value',
    PRIMARY KEY ('entity_id','attribute_id','store_id','value','source_id'),
    KEY 'NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_ATTRIBUTE_ID' ('attribute_id'),
    KEY 'NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_STORE_ID' ('store_id'),
    KEY 'NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_VALUE' ('value')
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Product EAV Decimal Index Table';
    et voici l'erreur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    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 ''natu_catalog_product_index_eav_decimal_replica' (
      'entity_id' int(10) unsigne' at line 1

  2. #2
    Membre prolifique Avatar de Artemus24
    Homme Profil pro
    Agent secret au service du président Ulysses S. Grant !
    Inscrit en
    Février 2011
    Messages
    6 914
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Agent secret au service du président Ulysses S. Grant !
    Secteur : Finance

    Informations forums :
    Inscription : Février 2011
    Messages : 6 914
    Par défaut
    Salut azaouali.

    Vous confondez l'apostrophe ' (touche 4) avec l'apostrophe inversée `(alt gr + touche 7).
    Pour la chaine de caractères dans le comment vous devez mettre l'apostrophe.
    Pour les noms de colonnes ainsi que le nom de la table, vous devez mettre l'apostrophe inversée.

    @+

  3. #3
    Modérateur
    Avatar de escartefigue
    Homme Profil pro
    bourreau
    Inscrit en
    Mars 2010
    Messages
    10 633
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loir et Cher (Centre)

    Informations professionnelles :
    Activité : bourreau
    Secteur : Finance

    Informations forums :
    Inscription : Mars 2010
    Messages : 10 633
    Billets dans le blog
    10
    Par défaut
    Bonjour,

    L'utilisation d'apostrophes inversées (AltGR+7) n'est requise que si des noms réservés sont utilisés, ce qui n'est évidemment pas recommandé.

  4. #4
    Membre confirmé
    Homme Profil pro
    Expert sécurité informatique
    Inscrit en
    Juillet 2020
    Messages
    142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Expert sécurité informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 142
    Par défaut
    Merci pour vos réponses.

  5. #5
    Membre confirmé
    Homme Profil pro
    Expert sécurité informatique
    Inscrit en
    Juillet 2020
    Messages
    142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Expert sécurité informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 142
    Par défaut
    Mais ça ne fonctionne toujours pas alors que j'ai suivi vos conseil :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    CREATE TABLE `natu_catalog_product_index_eav_decimal_replica` (
      `entity_id` int(10) unsigned NOT NULL COMMENT 'Entity ID',
      `attribute_id` smallint(5) unsigned NOT NULL COMMENT 'Attribute ID',
      `store_id` smallint(5) unsigned NOT NULL COMMENT 'Store ID',
      `value` decimal(12,4) NOT NULL COMMENT 'Value',
      `source_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Original entity Id for attribute
    value',
      PRIMARY KEY (`entity_id`,`attribute_id`,`store_id`,`value`,`source_id`),
      KEY `NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_ATTRIBUTE_ID` (`attribute_id`),
      KEY `NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_STORE_ID` (`store_id`),
      KEY `NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_VALUE` (`value`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Product EAV Decimal Index Table';
    alors que j'ai bien DROP la table mais il met l'erreur suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    ERROR 1050 (42S01): Table '`magento2`.`natu_catalog_product_index_eav_decimal_replica`' alr
    eady exists

  6. #6
    Modérateur
    Avatar de escartefigue
    Homme Profil pro
    bourreau
    Inscrit en
    Mars 2010
    Messages
    10 633
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loir et Cher (Centre)

    Informations professionnelles :
    Activité : bourreau
    Secteur : Finance

    Informations forums :
    Inscription : Mars 2010
    Messages : 10 633
    Billets dans le blog
    10
    Par défaut
    C'est que le drop n'a pas été fait dans la bonne database ou n'a pas été commité

    Pourquoi choisir des noms d'objets aussi longs et compliqués c'est une norme interne à l'entreprise dans laquelle vous intervenez ?
    Vraiment pas pratique des noms pareils !

  7. #7
    Membre prolifique Avatar de Artemus24
    Homme Profil pro
    Agent secret au service du président Ulysses S. Grant !
    Inscrit en
    Février 2011
    Messages
    6 914
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Agent secret au service du président Ulysses S. Grant !
    Secteur : Finance

    Informations forums :
    Inscription : Février 2011
    Messages : 6 914
    Par défaut
    Ca fonctionne très bien chez moi :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    --------------
    START TRANSACTION
    --------------
     
    --------------
    SHOW VARIABLES LIKE 'version'
    --------------
     
    +---------------+----------------+
    | Variable_name | Value          |
    +---------------+----------------+
    | version       | 10.5.8-MariaDB |
    +---------------+----------------+
    --------------
    DROP DATABASE IF EXISTS `base`
    --------------
     
    --------------
    CREATE DATABASE `base`
        DEFAULT CHARACTER SET `latin1`
        DEFAULT COLLATE       `latin1_general_ci`
    --------------
     
    --------------
    DROP TABLE IF EXISTS `natu_catalog_product_index_eav_decimal_replica`
    --------------
     
    --------------
    CREATE TABLE `natu_catalog_product_index_eav_decimal_replica`
    (  `entity_id`    integer  unsigned NOT NULL COMMENT 'Entity ID',
       `attribute_id` smallint unsigned NOT NULL COMMENT 'Attribute ID',
       `store_id`     smallint unsigned NOT NULL COMMENT 'Store ID',
       `value`        decimal(12,4)     NOT NULL COMMENT 'Value',
       `source_id`    integer  unsigned NOT NULL DEFAULT 0 COMMENT 'Original entity Id for attribute value',
       PRIMARY KEY (`entity_id`,`attribute_id`,`store_id`,`value`,`source_id`),
       KEY `NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_ATTRIBUTE_ID` (`attribute_id`),
       KEY `NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_STORE_ID`     (`store_id`),
       KEY `NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_VALUE`        (`value`)
    ) ENGINE=InnoDB
      DEFAULT CHARSET=utf8
      COMMENT='Catalog Product EAV Decimal Index Table'
    --------------
     
    --------------
    describe `natu_catalog_product_index_eav_decimal_replica`
    --------------
     
    +--------------+----------------------+------+-----+---------+-------+
    | Field        | Type                 | Null | Key | Default | Extra |
    +--------------+----------------------+------+-----+---------+-------+
    | entity_id    | int(10) unsigned     | NO   | PRI | NULL    |       |
    | attribute_id | smallint(5) unsigned | NO   | PRI | NULL    |       |
    | store_id     | smallint(5) unsigned | NO   | PRI | NULL    |       |
    | value        | decimal(12,4)        | NO   | PRI | NULL    |       |
    | source_id    | int(10) unsigned     | NO   | PRI | 0       |       |
    +--------------+----------------------+------+-----+---------+-------+
    --------------
    show index from `natu_catalog_product_index_eav_decimal_replica`
    --------------
     
    +------------------------------------------------+------------+-----------------------------------------------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
    | Table                                          | Non_unique | Key_name                                            | Seq_in_index | Column_name  | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
    +------------------------------------------------+------------+-----------------------------------------------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
    | natu_catalog_product_index_eav_decimal_replica |          0 | PRIMARY                                             |            1 | entity_id    | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
    | natu_catalog_product_index_eav_decimal_replica |          0 | PRIMARY                                             |            2 | attribute_id | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
    | natu_catalog_product_index_eav_decimal_replica |          0 | PRIMARY                                             |            3 | store_id     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
    | natu_catalog_product_index_eav_decimal_replica |          0 | PRIMARY                                             |            4 | value        | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
    | natu_catalog_product_index_eav_decimal_replica |          0 | PRIMARY                                             |            5 | source_id    | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
    | natu_catalog_product_index_eav_decimal_replica |          1 | NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_ATTRIBUTE_ID |            1 | attribute_id | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
    | natu_catalog_product_index_eav_decimal_replica |          1 | NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_STORE_ID     |            1 | store_id     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
    | natu_catalog_product_index_eav_decimal_replica |          1 | NATU_CATALOG_PRODUCT_INDEX_EAV_DECIMAL_VALUE        |            1 | value        | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
    +------------------------------------------------+------------+-----------------------------------------------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
    --------------
    COMMIT
    --------------
     
    Appuyez sur une touche pour continuer...
    Pour supprimer votre table, vous devez faire :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    drop `magento2`.`natu_catalog_product_index_eav_decimal_replica`;
    @+

Discussions similaires

  1. Erreur dans une création de table
    Par horacia dans le forum SQL
    Réponses: 1
    Dernier message: 23/05/2017, 12h13
  2. Problème dans la création d'une table
    Par HAM_10 dans le forum MS SQL Server
    Réponses: 4
    Dernier message: 09/02/2017, 23h48
  3. Réponses: 5
    Dernier message: 10/04/2010, 10h36
  4. Problème sur une création de table !
    Par pierre24 dans le forum SAS Base
    Réponses: 3
    Dernier message: 21/05/2008, 13h58
  5. Réponses: 2
    Dernier message: 10/02/2006, 14h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo