Вопрос задан 01.03.2019 в 14:12. Предмет Информатика. Спрашивает Жукова Рина.

accessНа основе таблицы «Поставки» сформировать запрос о создании нового поля Розничная Цена, в

котором подсчитывалось бы численное значение из поля Цена, увеличенное на 20%. Как прописать запрос?
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Сидоренко Влад.
Создаешь в конструкторе запросов
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Creating a Query to Add a New Field "Retail Price" Based on the "Supplies" Table

To create a query that adds a new field called "Retail Price" to the "Supplies" table, which calculates the numerical value from the "Price" field increased by 20%, you can use the following SQL statement:

```sql ALTER TABLE Supplies ADD COLUMN Retail_Price DECIMAL(10, 2); ```

This query adds a new column named "Retail_Price" to the "Supplies" table with a decimal data type of 10 digits in total, with 2 decimal places.

Next, you can update the values in the "Retail_Price" column by calculating the increased price based on the "Price" field. Here's an example of how you can write the update query:

```sql UPDATE Supplies SET Retail_Price = Price * 1.2; ```

This query multiplies the value in the "Price" column by 1.2 (which represents a 20% increase) and assigns the result to the "Retail_Price" column for each row in the "Supplies" table.

Please note that the exact syntax and table/column names may vary depending on the database management system you are using. Make sure to adjust the query accordingly.

Example:

Let's assume we have the following data in the "Supplies" table:

| Product | Price | |---------|-------| | A | 100 | | B | 350 | | C | 200 |

After running the above queries, the "Supplies" table would be updated as follows:

| Product | Price | Retail_Price | |---------|-------|--------------| | A | 100 | 120 | | B | 350 | 420 | | C | 200 | 240 |

The "Retail_Price" column now contains the calculated values based on the "Price" column, increased by 20%.

Please note that the actual implementation may vary depending on the specific database management system and table structure you are working with. It's always a good practice to consult the documentation or seek assistance from a database administrator if needed.

I hope this helps! Let me know if you have any further questions.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос