Difference between row and column in php

0

Hello many times I get confused because I create a table in phpMyAdmin and when I create a table I am creating columns. But nevertheless, other people create rows an example:

-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 04 mrt 2013 om 19:05
-- Serverversie: 5.5.24-log
-- PHP-versie: 5.3.13

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Databank: 'coffeedb'
--

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

--
-- Tabelstructuur voor tabel 'coffee'
--

CREATE TABLE IF NOT EXISTS 'coffee' (
  'id' int(11) NOT NULL AUTO_INCREMENT,
  'name' varchar(255) DEFAULT NULL,
  'type' varchar(255) DEFAULT NULL,
  'price' double DEFAULT NULL,
  'roast' varchar(255) DEFAULT NULL,
  'country' varchar(255) DEFAULT NULL,
  'image' varchar(255) DEFAULT NULL,
  'review' text,
  'ide' text,
  PRIMARY KEY ('id')
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Gegevens worden uitgevoerd voor tabel 'coffee'
--

INSERT INTO 'coffee' ('id', 'name', 'type', 'price', 'roast', 'country', 'image', 'review') VALUES
(1, 'Cafe au Lait', 'Classic', 2.25, 'Medium', 'France', 'Images/Coffee/Cafe-Au-Lait.jpg', 'A coffee beverage consisting strong or bold coffee (sometimes espresso) mixed with scalded milk in approximately a 1:1 ratio.'')'),
(2, 'Caffe Americano', 'Espresso', 3.25, 'Medium', 'Italy', 'Images/coffee/caffe_americano.jpg', 'Similar in strength and taste to American-style brewed coffee, there are subtle differences achieved by pulling a fresh shot of espresso for the beverage base.'),
(3, 'Peppermint White Chocolate Mocha', 'Espresso', 3.25, 'Medium', 'Italy', 'Images/coffee/white-chocolate-peppermint-mocha.jpg', 'Espresso with white chocolate and peppermint flavored syrups and steamed milk. Topped with sweetened whipped cream and dark chocolate curls.'),
(4, 'Galao', 'Latte', 4.2, 'Light', 'Portugal', 'Images/Coffee/galao_kaffee_portugal.jpg', 'Galao is a hot drink from Portugal made of espresso and foamed milk');

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

My question is how can I from phpMyAdmin create rows instead of columns. Columns are created through the INSERT INTO. How could I indicate in this code that I create columns instead of rows?

    
asked by Perl 11.09.2016 в 13:32
source

1 answer

1

First a quick explanation of the most relevant of the exposed code.

This part CREATES a table AND its columns :

CREATE TABLE IF NOT EXISTS 'coffee' (
  'id' int(11) NOT NULL AUTO_INCREMENT,
  'name' varchar(255) DEFAULT NULL,
  'type' varchar(255) DEFAULT NULL,
  'price' double DEFAULT NULL,
  'roast' varchar(255) DEFAULT NULL,
  'country' varchar(255) DEFAULT NULL,
  'image' varchar(255) DEFAULT NULL,
  'review' text,
  'ide' text,
  PRIMARY KEY ('id')
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

This other INSERT records in a table, or create a row s, so to speak:

INSERT INTO 'coffee' ('id', 'name', 'type', 'price', 'roast', 'country', 'image', 'review') VALUES
(1, 'Cafe au Lait', 'Classic', 2.25, 'Medium', 'France', 'Images/Coffee/Cafe-Au-Lait.jpg', 'A coffee beverage consisting strong or bold coffee (sometimes espresso) mixed with scalded milk in approximately a 1:1 ratio.'')'),
(2, 'Caffe Americano', 'Espresso', 3.25, 'Medium', 'Italy', 'Images/coffee/caffe_americano.jpg', 'Similar in strength and taste to American-style brewed coffee, there are subtle differences achieved by pulling a fresh shot of espresso for the beverage base.'),
(3, 'Peppermint White Chocolate Mocha', 'Espresso', 3.25, 'Medium', 'Italy', 'Images/coffee/white-chocolate-peppermint-mocha.jpg', 'Espresso with white chocolate and peppermint flavored syrups and steamed milk. Topped with sweetened whipped cream and dark chocolate curls.'),
(4, 'Galao', 'Latte', 4.2, 'Light', 'Portugal', 'Images/Coffee/galao_kaffee_portugal.jpg', 'Galao is a hot drink from Portugal made of espresso and foamed milk');

Now, by answering the question, NO you can create columns with INSERT INTO, you can only create (insert) rows.

To create columns there are two ways, when the table is created (see code above) and when the table was created previously, which I show below, using ALTER TABLE:

ALTER TABLE coffee ADD COLUMN cups INT NOT NULL;

Taking into account that the question also talks about phpmyadmin, it is also possible to add rows and columns through its graphical interface, in this video you can see how to add columns: link

    
answered by 11.09.2016 в 13:51