Using DML Statements – Notes from MVA Database Fundamentals

https://mva.microsoft.com/en-US/training-courses/database-fundamentals-8243?l=IAdTlyJy_004984382

Using DML Statements

I’ve been trying to get through this section of the course for a while now, so I’m basically forcing myself to take notes.

 ————–

DML – Data Manipulation Language

Common DML Statements:

SELECT – retrieves data
INSERT – adds data
UPDATE – modifies data
DELETE – removes data
BULK INSERT – imports a data file

The SELECT statement basically retrieves the data you request.

The most basic one is:

SELECT * FROM tablename;

This one will retrieve all rows and columns (including duplicates) from the table, “tablename.”

If you don’t want duplicate rows, you could use the following instead:

SELECT DISTINCT * from tablename;

I bring up the SELECT DISTINCT because in my work I almost always use SELECT DISTINCT rather than just SELECT, as I only very rarely want duplicates.

To limit the number of rows returned, one thing you can do is add a WHERE clause after the “FROM” clause that winnows down the data a bit more.

I’m only 2 minutes in, but it’s time for my bed. More notes tomorrow. 🙂