Ex in ru: Ex-In — Конструктор сайтов для генерации клиентов и продаж из интернета

SQL exercises

SQL exercises Language  Русский English April 07, 20:38 MSK

Ratings

Statistics

SQL exercises

Forums

Certification

HELP

Query optimization

Personal page
Developers & Thanks
For employers
References
Feedback
Support SQL-EX. RU


Документы

Today we have 950 visitors (114 new).
27 exercises solved (4 on SELECT and 23 on DML),
on learning stage — 1769

Site news 2022-12-23
All the news    Week news
Certified within this week:

Ershov I.(qzva)
Last certified.
Confirm certificate
Happy Birthday to:
Aleksandr  (A. Mozolini)
Pavlov E.A. (Eugene Pavlov)
Tupikin M.I. (maivtu)
Shilova  N. (Neznakomka)
!!!

The nearest birthdays.
Telegram channel SQL-Ex.

Top 100 on latest exercises.

Visual modelling (Painting database).



There are exercises on SELECT statement (presently 182 exercises on learn stage and 238 exercises on rating stages) and on other data manipulation operators — INSERT, UPDATE, DELETE, and MERGE (55 exercises). The rating of members is carried on SELECT exercises. See test conditions.
The book «SQL. Problems and solutions» , which is analyzing the characteristic mistakes admitted at the solution of the learn-stage exercises on the site, was originally published in Peter Publishing Company.


Read last site news.

Practical skills of SQL language

This site will help everyone to gain or improve skills in building SQL Data Manipulation Language statements. To train You will have to build yourself the SQL statements for retrieval or modification of specific data required in the exercises. When Your query is incorrect, You will be able to see rows returned by the correct query along with that returned by Your query. Furthermore, you may execute arbitrary DML statements on available databases by setting the «Without checking» option. There are five levels of difficulty (from 1 to 5), You may see it in second column of exercises list. We propose the exercises on retrieving data (SELECT statement) and the exercises on modifying data (

INSERT, UPDATE, DELETE, and MERGE statements). Your success in the solving the exercises are shown by a rating of participants. As this takes place, there are three stages: the first one (first 5 exercises) is performed without time control for an individual exercise, the second one (begins with the exercise #6) controls time for completion of each task. At the third stage which refers to optimizing and begins with exercise #139, it is required not only to solve an exercise correctly, but also time of execution of inquiry should be commensurable with time of execution of the author’s solution.
Exercises of the first stage are available without registration and may be solved in any order You like. The solution of the rest of exercises requires registration.
REGISTRATION IS FREE
as this for all other services of the site. In the third column of exercises list You will be able to see («OK») notes with the numbers of done exercises, but that is available only to the registered users. In fact, that is the main reason for registration. If You would like to visit our web site again, You won’t have to recollect which exercises You have done already and which You haven’t. If You don’t want to register, You may enter as a guest, but in that case Your results won’t be traced by the system. Registered users also may discuss the solutions to exercises in our forum.

NOTE: The query stated incorrectly may return the «correct» data on a current state of database. For this reason You should not be surprised if the results of incorrect query are coincide with the results of right one with Your query is estimated as incorrect by the Verifying system.

NOTE: Your browser should support Cookies and Javascript to provide correct usage of this site. If you use content filter, it should allow opening child windows to explore help pages.

Certification

Successful testing of yours can be confirmed by the certificate «SQL Data Manipulation Language Specialist».

We support quality of our certificate by periodically replacing exercises and changing the certificate requirements.

More about certification. What does the certificate give to you?

SQL syntax used

User’s queries are executed by SQL server that brings some limitations to the syntax of SQL statements. Now we use Microsoft SQL Server 2019 (15.0) on the rating stages, and MariaDB-10.4 (compatible with MySQL 8), PostgreSQL 12.3, and Oracle Database 11g on the learn stage in addition. That is why You should follow the syntax of these realizations when building queries. It should be noted that SQL syntax, implemented in Microsoft SQL Server, is close to that of

SQL-92 standard. But there are some distinctions, among them is absence of NATURAL JOIN of tables. Supplied help on SQL Data Manipulation Language is held in accordance with SQL-92 standard and contains information necessary for solving the exercises. In the same place it is possible to find features of used realization (SQL Server 2005).

Top 10 results

Person ScoresDaysDays_2Days_3Scores_3
Chernov D.V. (Kursist)
706
20811602.3881710.888256
Filippkin D.V. (_dimon_) 7075040224.192156.502255
Doschenko V. N. (mcrain) 67138782042.874525.210252
Kostomarov A.V. (al29) 64932794333.7822473.867251
Kreslavskij O.M. (Arcan)
6955467284.368225.498248
Krasovskij E.A. (pegoopik) 6734519210.57714.367248
Bezhaev A.Yu. (Baser) 6614678266. 002347.687240
Boiko D. (Angellore) 65451385433.7553825.743237
Dubinskij A.V. (_velial) 65241202797.4683371.376227
Karasyova N.V. (vlksm) 6675809291.756242.855225

SELECT statement exercises: learning stage

SELECT statement exercises: learning stage
SQL exercises Language  Русский English April 07, 20:38 MSK
SQL Exercises is intended for acquiring good practical experience, which is focused on data operation, namely on SQL DML. Certain exercises for beginners are provided on the site, they are supplied with the necessary reference source on SQL syntax with a great number of examples. Apart from them, 3 rating stages are suggested, they are aimed at testing of specialists and their certification. The source is absolutely free of charge, and the certificate purchase has a voluntary basis.
NOTE: Your browser should support Cookies and Javascript to provide correct usage of this site. If you use content filter, it should allow opening child windows to explore help pages.

    Here you can get practice in constructing queries on data retrieving (SELECT statement of SQL language). The exercises included are addressing to beginners and can be solved in arbitrary order. In order your solutions have been stored in system, the statistics of the solved exercises were conducted, there was an opportunity of participation in ratings and discussions in forum the registration and the authorized logon is required.
    On exercises’ page it’s possible to carry out any SELECT statements which are addressing to the learning databases. To switch off checking the correctness of the solutions, click «without check» checkbox.
If you consider yourself as a professional and plan to compete with others or to get certificate, proceed to certification stages.
    More about certification.
If you are recently on the site, we recommend you to read site rules and answers on FAQ.

Home
Week news

Certification

SQL exercises

Forums

Ratings

HELP

Performance

Profile
References
Copyright SQL-EX © 2002-2018. All rights reserved.
contact

Состав Ru-Ex | Национальный музей американской истории

Предыдущий

Следующий

>>

Применяются условия использования

Загрузки

Применяются условия использования

Загрузки

Применяются условия использования

Загрузки

Применяются условия использования

Загрузки
Местоположение
В настоящее время не отображается
Имя объекта
безрецептурный препарат
Тип объекта
Наркотики
производитель
Компания Ру-Экс
Физическое описание
картон (тарный материал)
металл (материал емкости)
Измерения
общий: 8 см х 6,5 см; 3 1/8 дюйма x 2 9/16 дюйма
в целом: 3 1/8 дюйма x 2 1/2 дюйма; 7,9375 см x 6,35 см
Идентификационный номер
1985. 0481.103
регистрационный номер
1985.0481
каталожный номер
1985.0481.103
регистрационный номер
1985.0481
Кредитная линия
Дар Сидни Глейзера
Посмотреть больше товаров в
Медицина и наука: медицина
Бальзам Америки
Источник данных
Национальный музей американской истории

Номинировать этот объект для фотографирования.

Наша база данных коллекций находится в стадии разработки. Мы можем обновить эту запись на основе дальнейших исследований и обзоров. Узнайте больше о нашем подходе к публикации нашей коллекции в Интернете.

Если вы хотите узнать, как вы можете использовать содержимое этой страницы, ознакомьтесь с Условиями использования Смитсоновского института. Если вам нужно запросить изображение для публикации или другого использования, посетите страницу Права и репродукции.

Примечание. Отправка комментариев временно недоступна, пока мы работаем над улучшением сайта. Приносим извинения за прерывание. Если у вас есть вопрос, касающийся коллекций музея, сначала ознакомьтесь с часто задаваемыми вопросами о коллекциях. Если вам нужен личный ответ, воспользуйтесь нашей контактной страницей.

mysql — Где ошибка в этом запросе? (sql-ex.ru упражнение 25)

спросил

Изменено 1 год, 9 месяцев назад

Просмотрено 684 раза

Пытаюсь решить Упражнение 25 с сайта sql-ex. ru:

Схема базы данных состоит из четырех таблиц:

  • Продукт (производитель, модель, тип)
  • ПК(код, модель, скорость, оперативка, hd, cd, цена)
  • Ноутбук(код, модель, скорость, оперативка, hd, экран, цена)
  • Принтер(код, модель, цвет, тип, цена)

Найдите производителей принтеров, которые также производят ПК с наименьшим объемом ОЗУ и самой высокой скоростью процессора среди всех ПК с наименьшим объемом ОЗУ. Набор результатов: производитель.

Я не понимаю, почему следующий запрос не дает желаемого результата для второй проверочной базы данных:

 ВЫБЕРИТЕ ОТЛИЧНЫЙ product.maker
ИЗ продукта
ПРАВОЕ СОЕДИНЕНИЕ принтер ВКЛ принтер.модель = продукт.модель
ГДЕ product.maker IN(
    ВЫБЕРИТЕ продукт.производитель
    ИЗ продукта
    ПРАВОЕ СОЕДИНЕНИЕ pc ON pc.model = product.model
    ГДЕ pc.ram = (ВЫБЕРИТЕ МИН.(ram) FROM pc)
    И пк.скорость = (
        ВЫБЕРИТЕ МАКС(t. скорость)
        ОТ (ВЫБЕРИТЕ скорость ОТ ПК, ГДЕ ОЗУ = (ВЫБЕРИТЕ МИН(ОЗУ) ОТ ПК)) КАК t
    )
)
 

Ошибка следующая:

 Неправильно
Ваш запрос дал правильный набор результатов в основной базе данных, но не прошел проверку во второй, проверив базу данных
* Неверное количество записей (меньше на 1)
 

Почему не удается выбрать ровно 1 производителя?

  • MySQL
  • SQL

2

Я не знаю, где ошибка в вашем запросе, но вы можете использовать что-то вроде этого:

 

С т АС ( SELECT * FROM PC c WHERE c.ram = (SELECT MIN(ram) FROM PC) ) ВЫБЕРИТЕ ОТЛИЧНЫЙ a.maker ОТ Продукта, ГДЕ a.type = 'ПК' И a.maker В ( ВЫБЕРИТЕ b.maker ИЗ продукта b ГДЕ b.type = 'Принтер' ) И а.модель В ( ВЫБЕРИТЕ модель ИЗ t ГДЕ скорость = (ВЫБЕРИТЕ МАКС(скорость) ИЗ t) )

2

Вот решение этой проблемы:

 WITH CTE_Product AS
(
 ВЫБЕРИТЕ ОТЛИЧНЫЙ
 Создатель
 ОТ
 Продукт
 ГДЕ
 Тип = 'ПК'
 И
 Maker IN (ВЫБЕРИТЕ Maker FROM Product WHERE Type = 'Printer')
)
выберите c.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *