Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

SQL Server Tutorial : How DML triggers are used

Автор: DataCamp

Загружено: 2020-04-12

Просмотров: 1069

Описание:

Want to learn more? Take the full course at https://learn.datacamp.com/courses/bu... at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.

---

Now that you have a basic understanding of what triggers are, let's find out more about the reasons for using them.

Developers and database administrators can create and use triggers for a multitude of purposes.

The main reason for using triggers is to initiate actions when manipulating data (inserting, modifying, or deleting information).
Sometimes the manipulation of data needs to be prevented, and this can also be done with the use of triggers.

Another use case often seen in practice is using triggers for tracking data changes and even database object changes.
Database admins also use triggers to track user actions and to secure the database by protecting it from unwanted changes.

As mentioned earlier, it's important to understand the difference between the AFTER and INSTEAD OF trigger types so you know when to use each.

From a trigger definition perspective, the two types of triggers look almost the same.
But in practice, they will have very different outcomes when fired.

The outcome of the trigger execution is highly dependent on the keyword you choose (AFTER or INSTEAD OF).

The AFTER trigger adds new statements to the initial one, while the INSTEAD OF trigger prevents the initial statement from executing.

This difference will influence the use cases for each type of trigger.

One example of using an AFTER trigger is for a large insert of data into a sales table.

Once that data gets inserted, a cleansing step should run to remove or repair any unwanted information. The cleansing step will be started by the trigger.

When the cleansing step finishes, a report with the results will be generated.

This report should be analyzed by a database administrator, so the trigger will then send an email to the responsible people.
This is all part of the trigger definition.

Now let's look at an example where using an INSTEAD OF trigger is appropriate.

Imagine you have a table containing light bulb information and stock details for a sales platform.

The "Power" column values have changed for some models, and an update is initiated to change the information in the table.

There are still some bulb models in stock that have the old power values, however, and they shouldn't be updated.

An INSTEAD OF trigger can help you deal with this more complex situation.

The correct approach is to update the characteristics only for the models that don't have the old version in stock.

The new models need to be in the table too, but as new rows instead of updated ones.

The only limit on the use cases of DML triggers is your imagination. This doesn't mean triggers are the answer to all of your problems, but that's a topic we'll discuss in the next lesson.

For now, let's recap what you've learned with a couple of questions!


#DataCamp #SQLServerTutorial

SQL Server Tutorial : How DML triggers are used

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

6 SQL-соединений, которые вы ОБЯЗАТЕЛЬНО должны знать! (Анимация + Практика)

6 SQL-соединений, которые вы ОБЯЗАТЕЛЬНО должны знать! (Анимация + Практика)

SQL Index |¦| Indexes in SQL |¦| Database Index

SQL Index |¦| Indexes in SQL |¦| Database Index

SQL Triggers (Visually Explained) | Audit Logs Use Case | #SQL Course 34

SQL Triggers (Visually Explained) | Audit Logs Use Case | #SQL Course 34

DML Triggers in SQL

DML Triggers in SQL

Вся база SQL для начинающих за 1 час

Вся база SQL для начинающих за 1 час

РЕАЛЬНОЕ собеседование на Data Scientist. Алгоритмы + Python

РЕАЛЬНОЕ собеседование на Data Scientist. Алгоритмы + Python

Прощай Киевстар

Прощай Киевстар

Вам нужно изучить SQL ПРЯМО СЕЙЧАС!! (Учебник SQL для начинающих)

Вам нужно изучить SQL ПРЯМО СЕЙЧАС!! (Учебник SQL для начинающих)

Прорыв границы / Экстренная переброска военных

Прорыв границы / Экстренная переброска военных

Самая холодная деревня в мире: Оймякон (-71°C)

Самая холодная деревня в мире: Оймякон (-71°C)

SQL Triggers | SQL Tutorial for Beginners in 2021| SQL Triggers with Examples | Great Learning

SQL Triggers | SQL Tutorial for Beginners in 2021| SQL Triggers with Examples | Great Learning

DML Triggers in SQL Server: Types, Examples, and Practical Guide

DML Triggers in SQL Server: Types, Examples, and Practical Guide

Я Обманул Экспертов Элитной Парфюмерии Спреем с Пердежом

Я Обманул Экспертов Элитной Парфюмерии Спреем с Пердежом

Путин сделал угрозу НАТО реальной.

Путин сделал угрозу НАТО реальной.

Выживи 30 Дней Взаперти В Небе, Выиграй $250,000

Выживи 30 Дней Взаперти В Небе, Выиграй $250,000

Windows 11 26H1 - Microsoft снова переобулись?

Windows 11 26H1 - Microsoft снова переобулись?

DML triggers in sql server   Part 43

DML triggers in sql server Part 43

Why use Change Data Capture | Batch Data vs Streaming Data

Why use Change Data Capture | Batch Data vs Streaming Data

Программирование SQL Server, часть 15 — Триггеры DML

Программирование SQL Server, часть 15 — Триггеры DML

Я посетил подземных кротолюдей (они живут без солнца)

Я посетил подземных кротолюдей (они живут без солнца)

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com