• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 15 pages
Exam (elaborations)

WGU c170 The Most Important SQL Commands.docx

Document preview thumbnail
Preview 2 out of 15 pages

WGU c170 The Most Important SQL C

Content preview

WGU c170 The Most Important
SQL Commands(SQL study guide)
Course

WGU c170

1. CREATE DATABASE
Creates a new database.

CREATE DATABASE SchoolDB;



2. USE DATABASE
Selects the database you want to work with.

USE SchoolDB;



3. CREATE TABLE
Creates a new table.

CREATE TABLE Student (
StudentID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Email VARCHAR(100)
);



4. PRIMARY KEY
Uniquely identifies each row.

CREATE TABLE Student (
StudentID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50)
);

Remember: A primary key must uniquely identify a record and cannot be NULL.

, 5. FOREIGN KEY
Creates a relationship between tables.

CREATE TABLE Enrollment (
EnrollmentID INT PRIMARY KEY,
StudentID INT,
CourseID INT,
FOREIGN KEY (StudentID) REFERENCES Student(StudentID),
FOREIGN KEY (CourseID) REFERENCES Course(CourseID)
);

Remember:

PRIMARY KEY = identifies the row
FOREIGN KEY = connects tables



6. INSERT INTO
Adds records to a table.

INSERT INTO Student (StudentID, FirstName, LastName, Email)
VALUES (1, 'John', 'Smith', '');

Multiple rows:

INSERT INTO Student (StudentID, FirstName, LastName, Email)
VALUES
(2, 'Mary', 'Jones', ''),
(3, 'David', 'Brown', '');



7. SELECT
Retrieves data.

SELECT *
FROM Student;

Select specific columns:

SELECT FirstName, LastName
FROM Student;

Document information

Uploaded on
September 2, 2026
Number of pages
15
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$14.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
CLINICALNURSING
3.7
(6)
Sold
45
Followers
5
Items
1053
Last sold
9 hours ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions