SET FOREIGN_KEY_CHECKS=0; SET UNIQUE_CHECKS=0; SET NAMES LATIN2;

--
-- Host: localhost    Database: hd
-- ------------------------------------------------------


drop database if exists nf0;
create database nf0;
use nf0;

--
-- Table structure for table `ksiegarnia`
--

CREATE TABLE `ksiegarnia` (
  `tytul` varchar(200) default NULL,
  `autor` varchar(200) default NULL,
  `bio` text,
  `isbn` char(13) NOT NULL,
  `tematyka` text,
  `stron` smallint(6) default NULL,
  `wydawca` text,
  PRIMARY KEY  (`isbn`)
) ENGINE=MyISAM DEFAULT CHARSET=latin2;


DROP VIEW IF EXISTS ksiegarnia_v;
CREATE VIEW ksiegarnia_v AS
    select
        if (15 < length(tytul), concat(substring(tytul from 1 for 15), '...'), tytul) as tytul,
        autor,
        if (10 < length(bio), concat(substring(bio from 1 for 10), '...'), bio) as bio,
        isbn,
        if (10 < length(tematyka), concat(substring(tematyka from 1 for 10), '...'), tematyka) as tematyka,
        stron,
        if (10 < length(wydawca), concat(substring(wydawca from 1 for 10), '...'), wydawca) as wydawca
    from ksiegarnia;


--
-- Dumping data for table `ksiegarnia`
--

INSERT INTO `ksiegarnia` VALUES ('MySQL Database Design and Optimization','Chad Russell, Jon Stephens','Chad Russell to programista, Jon Stephens to członek zespołu MySQL','1590593324000','MySQL, projektowanie baz danych',520,'Apress, 2560 Ninth Street, Station 219 Berkeley California 94710'),('So You\'d Like To Use MySQL...','John Stephens','Autor zna się na MySQL','1937287539014','MySQL, zarządzanie bazą danych',67,'Realy Linux, otchłań sieci internet'),('PHP Development Tool Essentials','Chad Russell','','9781484206836','PHP, programowanie',109,'Apress, 2560 Ninth Street, Station 210 Berkeley California 94710'),('MySQL Developer\'s Library','DuBois Paul','Programista','9780321833877','MySQL, programowanie',1176,'New Riders Publications, 1301 Sansome Street, San Francisco, CA 94111'),('Expert MySQL','Bell Charles','Pracuje w zespole Oracle MySQL','9781430246602','MySQL, database management',640,'Apress, 2560 Ninth Street, Station 219 Berkeley California 9471');


