Compare commits
6 Commits
main
...
Laboratory
Author | SHA1 | Date | |
---|---|---|---|
|
910043144d | ||
|
973ee54756 | ||
|
84fcba6200 | ||
|
851d8c0c6d | ||
|
7849dd4531 | ||
|
a0a3fd0be4 |
33
Lab 5-6/book.xml
Normal file
33
Lab 5-6/book.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml-stylesheet type="text/xml" href="library.xsl" version="2.0"?>
|
||||
|
||||
<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<row>
|
||||
<bookid>1</bookid>
|
||||
<genreid>1</genreid>
|
||||
<title>Преступление и наказание</title>
|
||||
<author>Ф.М.Достоевский</author>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<bookid>2</bookid>
|
||||
<genreid>1</genreid>
|
||||
<title>Мёртвые души</title>
|
||||
<author>Н.В.Гоголь</author>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<bookid>3</bookid>
|
||||
<genreid>2</genreid>
|
||||
<title>Улитка на склоне</title>
|
||||
<author>Братья Стругацкие</author>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<bookid>4</bookid>
|
||||
<genreid>3</genreid>
|
||||
<title>Любовь хулигана</title>
|
||||
<author>С.А.Есенин</author>
|
||||
</row>
|
||||
|
||||
</book>
|
23
Lab 5-6/employee.xml
Normal file
23
Lab 5-6/employee.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml-stylesheet type="text/xml" href="library.xsl" version="2.0"?>
|
||||
|
||||
<employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<row>
|
||||
<employeeid>1</employeeid>
|
||||
<genreid>3</genreid>
|
||||
<fio>Иванов Иван Иванович</fio>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<employeeid>2</employeeid>
|
||||
<genreid>2</genreid>
|
||||
<fio>Медведев Евгений Юрьевич</fio>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<employeeid>3</employeeid>
|
||||
<genreid>1</genreid>
|
||||
<fio>Михайлова Юлия Вадимовна</fio>
|
||||
</row>
|
||||
|
||||
</employee>
|
20
Lab 5-6/genre.xml
Normal file
20
Lab 5-6/genre.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml-stylesheet type="text/xml" href="library.xsl" version="2.0"?>
|
||||
|
||||
<genre xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<row>
|
||||
<genreid>1</genreid>
|
||||
<genrename>Классика</genrename>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<genreid>2</genreid>
|
||||
<genrename>Научная фантастика</genrename>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<genreid>3</genreid>
|
||||
<genrename>Поэзия</genrename>
|
||||
</row>
|
||||
|
||||
</genre>
|
53
Lab 5-6/library.xsl
Normal file
53
Lab 5-6/library.xsl
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<body>
|
||||
<h1 align="center">Library</h1>
|
||||
<table border="3" align="center" >
|
||||
<tr>
|
||||
<th>ID жанра</th>
|
||||
<th>Название жанра</th>
|
||||
</tr>
|
||||
<xsl:for-each select="genre/row">
|
||||
<tr>
|
||||
<td><xsl:value-of select="genreid"/></td>
|
||||
<td><xsl:value-of select="genrename"/></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
<table border="3" align="center" >
|
||||
<tr>
|
||||
<th>ID сотрудника</th>
|
||||
<th>ID жанра</th>
|
||||
<th>ФИО</th>
|
||||
</tr>
|
||||
<xsl:for-each select="employee/row">
|
||||
<tr>
|
||||
<td><xsl:value-of select="employeeid"/></td>
|
||||
<td><xsl:value-of select="genreid"/></td>
|
||||
<td><xsl:value-of select="fio"/></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
<table border="3" align="center" >
|
||||
<tr>
|
||||
<th>ID книги</th>
|
||||
<th>ID жанра</th>
|
||||
<th>Название</th>
|
||||
<th>Автор</th>
|
||||
</tr>
|
||||
<xsl:for-each select="book/row">
|
||||
<tr>
|
||||
<td><xsl:value-of select="bookid"/></td>
|
||||
<td><xsl:value-of select="genreid"/></td>
|
||||
<td><xsl:value-of select="title"/></td>
|
||||
<td><xsl:value-of select="author"/></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
54
Lab 5-6/script.txt
Normal file
54
Lab 5-6/script.txt
Normal file
@ -0,0 +1,54 @@
|
||||
CREATE TABLE Genre (
|
||||
GenreID INTEGER PRIMARY KEY,
|
||||
GenreName varchar(30) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE Employee (
|
||||
EmployeeID int PRIMARY KEY,
|
||||
GenreID INTEGER,
|
||||
FIO varchar(50) NOT NULL,
|
||||
|
||||
FOREIGN KEY (GenreID) REFERENCES Genre (GenreID)
|
||||
);
|
||||
|
||||
CREATE TABLE Book (
|
||||
BookID INTEGER PRIMARY KEY,
|
||||
GenreID INTEGER,
|
||||
Title varchar(200) NOT NULL,
|
||||
Author varchar(200) NOT NULL,
|
||||
|
||||
FOREIGN KEY (GenreID) REFERENCES Genre (GenreID)
|
||||
);
|
||||
|
||||
INSERT INTO Genre VALUES
|
||||
(1, 'Классика'),
|
||||
(2, 'Научная фантастика'),
|
||||
(3, 'Поэзия')
|
||||
|
||||
INSERT INTO Employee VALUES
|
||||
(1, 3, 'Иванов Иван Иванович'),
|
||||
(2, 2, 'Медведев Евгений Юрьевич'),
|
||||
(3, 1, 'Михайлова Юлия Вадимовна')
|
||||
|
||||
INSERT INTO Book VALUES
|
||||
(1, 1, 'Преступление и наказание', 'Ф.М.Достоевский'),
|
||||
(2, 1, 'Мёртвые души', 'Н.В.Гоголь'),
|
||||
(3, 2, 'Улитка на склоне', 'Братья Стругацкие'),
|
||||
(4, 3, 'Любовь хулигана', 'С.А.Есенин')
|
||||
|
||||
COPY (SELECT table_to_xml('Genre', true, false, '')) to 'E:\MiAKD\Lab 5-6\genre.xml';
|
||||
COPY (SELECT table_to_xml('Employee', true, false, '')) to 'E:\MiAKD\Lab 5-6\employee.xml';
|
||||
COPY (SELECT table_to_xml('Book', true, false, '')) to 'E:\MiAKD\Lab 5-6\book.xml';
|
||||
|
||||
|
||||
|
||||
/* === Индексы (6 lab) === */
|
||||
|
||||
CREATE INDEX index_g
|
||||
ON Genre (GenreID)
|
||||
|
||||
CREATE INDEX index_e
|
||||
ON Employee (EmployeeID)
|
||||
|
||||
CREATE INDEX index_b
|
||||
ON Book (BookID)
|
BIN
Сценарии.docx
Normal file
BIN
Сценарии.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user