Avatar billede TBS Juniormester
21. maj 2020 - 14:19 Der er 5 kommentarer og
1 løsning

SQL

Jeg får en fejl når jeg prøver at køre forspørgelsen:
--
-- Table structure for table `category`
--

CREATE TABLE `category` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `category`
--
ALTER TABLE `category`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

In products table, I'm creating 6 columns with id, name, category id, product price, product image thumbnail, product description.

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `catid` int(11) NOT NULL,
  `price` varchar(255) NOT NULL,
  `thumb` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

Hvad skal jeg gøre for at den ikke fejler?
Avatar billede arne_v Ekspert
21. maj 2020 - 14:30 #1
Har du lyst til at afsløre hvilken fejl du får på hvilken SQL sætning?
Avatar billede TBS Juniormester
21. maj 2020 - 14:47 #2
Fejl
Statisk analyse:

Der blev fundet 2 fejl under analysen.

Slut quote ' var ventet. (near "" at position 755)
Ukendt type af statement. (near "IN" at position 0)
SQL-forespørgsel: Kopi

IN products TABLE, I 'm creating 6 columns with id, name, category id, product price, product image thumbnail, product description. -- -- Table structure for table `products` -- CREATE TABLE `products` ( `id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `catid` int(11) NOT NULL, `price` varchar(255) NOT NULL, `thumb` varchar(255) NOT NULL, `description` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `products` -- ALTER TABLE `products` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `products` -- ALTER TABLE `products` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

MySQL returnerede: Dokumentation

#1064 - Der er en fejl i SQL syntaksen nær 'IN products TABLE,
    I 'm creating 6 columns with id, name, category id, prod' på linje 1
Avatar billede TBS Juniormester
21. maj 2020 - 14:57 #3
Linje 30:
  In products table, I'm creating 6 columns with id, name, category id, product price,
  product image thumbnail, product description.
Ukendt type af statement. (Nær In)

Linje 36:
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
Slut quote ' var ventet. (nær )
Avatar billede arne_v Ekspert
21. maj 2020 - 14:58 #4
Øhm.

"In products table, I'm creating 6 columns with id, name, category id, product price, product image thumbnail, product description."

er engelsk ikke SQL.
Avatar billede TBS Juniormester
21. maj 2020 - 15:00 #5
Åhh, jeg prøver lige at fjerne det
Avatar billede TBS Juniormester
21. maj 2020 - 15:01 #6
Det hjalp. Tak
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester