To find a data line of work in 2023, you will have to learn SQL. Similarly, as with any language and particularly when you are a fledgling, it very well may be valuable to have a rundown of normal SQL orders and administrators in a single spot to allude to at whatever point you want it — we might want to be that spot for you!
The following is a complete rundown of SQL orders, coordinated by the high level of each (for example SELECT TOP is inside the SELECT class) in Top SQL Commands
In the event that you're on an excursion to learn SQL and you've been baffled by the absence of design or the dull educational plan made out of Google look, then, at that point, you might like Dataquest's intuitive SQL courses. Whether you're a novice attempting to prepare work or a carefully prepared engineer hoping to remain sharp, there's a SQL course for you.
SELECT is probably the most commonly-used SQL statement. You’ll use it pretty much every time you query data with SQL. It allows you to define what data you want your query to return.
For example, in the code below, we’re selecting a column called name from a table called customers.
SELECT name
FROM customers;
SELECT used with an asterisk (*) will return all of the columns in the table we’re querying.
SELECT * FROM customers;
SELECT DISTINCT only returns data that is distinct — in other words, if there are duplicate records, it will return only one copy of each.
The code below would return only rows with a unique name from the customer's table.
SELECT DISTINCT name
FROM customers;
SELECT INTO copies the specified data from one table into another.
SELECT * INTO customers
FROM customers_backup;
SELECT TOP only returns the top x number or percent from a table.
The code below would return the top 50 results from the customer's table:
SELECT TOP 50 * FROM customers;
The code below would return the top 50 percent of the customer's table:
SELECT TOP 50 PERCENT * FROM customers;
AS renames a column or table with an alias that we can choose. For example, in the code below, we’re renaming the name column as first_name:
SELECT name AS first_name
FROM customers;
FROM specifies the table we’re pulling our data from:
SELECT name
FROM customers;
WHERE filters your query to only return results that match a set condition. We can use this together with conditional operators like =, >, <, >=, <=, etc.
SELECT name
FROM customers
WHERE name = ‘Bob’;
AND combines two or more conditions in a single query. All of the conditions must be met for the result to be returned.
SELECT name
FROM customers
WHERE name = ‘Bob’ AND age = 55;
OR combines two or more conditions in a single query. Only one of the conditions must be met for a result to be returned.
SELECT name
FROM customers
WHERE name = ‘Bob’ OR age = 55;
BETWEEN filters your query to return only results that fit a specified range.
SELECT name
FROM customers
WHERE age BETWEEN 45 AND 55;
LIKE searches for a specified pattern in a column. In the example code below, any row with a name that included the character Bob would be returned.
SELECT name
FROM customers
WHERE name LIKE ‘%Bob%’;
Other operators for LIKE:
IN allows us to specify multiple values we want to select when using the WHERE command.
SELECT name
FROM customers
WHERE name IN (‘Bob’, ‘Fred’, ‘Harry’);
IS NULL will return only rows with a NULL value.
SELECT name
FROM customers
WHERE name IS NULL;
IS NOT NULL does the opposite — it will return only rows without a NULL value.
SELECT name
FROM customers
WHERE name IS NOT NULL;
CREATE can be used to set up a database, table, index, or view.
CREATE DATABASE creates a new database, assuming the user running the command has the correct admin rights.
CREATE DATABASE dataquestDB;
CREATE TABLE creates a new table inside a database. The terms int and varchar(255) in this example specify the datatypes of the columns we’re creating.
CREATE TABLE customers (
customer_id int,
name varchar(255),
age int
);
CREATE INDEX generates an index for a table. Indexes are used to retrieve data from a database faster.
CREATE INDEX idx_name
ON customers (name);
CREATE VIEW creates a virtual table based on the result set of an SQL statement. A view is like a regular table (and can be queried like one), but it is not saved as a permanent table in the database.
CREATE VIEW [Bob Customers] AS
SELECT name, age
FROM customers
WHERE name = ‘Bob’;
DROP statements can be used to delete entire databases, tables, or indexes.
It goes without saying that the DROP command should only be used where absolutely necessary.
DROP DATABASE deletes the entire database including all of its tables, indexes, etc as well as all the data within it.
Again, this is a command we want to be very, very careful about using!
DROP DATABASE dataquestDB;
DROP TABLE deletes a table as well as the data within it.
DROP TABLE customers;
DROP INDEX deletes an index within a database.
DROP INDEX idx_name;
The UPDATE statement is used to update data in a table. For example, the code below would update the age of any customer named Bob in the customer's table to 56.
UPDATE customers
SET age = 56
WHERE name = ‘Bob’;
DELETE can remove all rows from a table (using ), or can be used as part of a WHERE clause to delete rows that meet a specific condition.
DELETE FROM customers
WHERE name = ‘Bob’;
ALTER TABLE allows you to add or remove columns from a table. In the code snippets below, we’ll add and then remove a column for a surname. The text varchar(255) specifies the datatype of the column.
ALTER TABLE customers
ADD surname varchar(255);
ALTER TABLE customers
DROP COLUMN surname;
That's all. These all are the basic SQL Commands
Also, Read What is Figma Ui UX Design and Why Does it Matter?
Expand TikTok audience: Craft captivating content, engage with trends, use hashtags wisely, collaborate, post consistently, and interact with followers.
Popular game streaming site Twitch has suffered a big records breach. Data together with all Twitch supply code, writer pay, passwords, account credentials, emails, and greater. Leaked on-line.
Discover the top 8 AI Chrome extensions for productivity in 2025. Boost your efficiency and streamline your workflow with these must-have tools!
1. Offer free, original, and quality content on your site. 2. Supplement your original content. 3. Trying to get more backlinks on your website this may help to increase the traffic 4. Improve your search engine ranking 5. Get linked. 6. Use social
Facebook said Tuesday it received more than 25,000 government data requests in the first half of 2013, with the largest number from the United States. The company`s first "transparency report" showed Facebook received between 11,000 and 12
The joint venture will allow the purchase of lithium to make electric vehicle batteries in the United States
A cryptocurrency wallet is a piece of software that generates a pair of cryptographic keys that are fully random. Individuals can use these keys to send and receive Bitcoin (and other cryptocurrencies). However, the name "wallet" is a little deceptive. A cryptocurrency wallet, unlike a physical wallet, does not keep any funds. Only the blockchain of the cryptocurrency for which the wallet was built is communicated with by the application.
We are offering the various Fire Safety Course in Patna like Safety institute in Patna, safety institute training in Patna, safety officer course training in Patna, Industrial safety training in Patna, fire safety management, construction safety institute in Patna, online safety course. We also provide IOSH training and NEBOSH training course in Patna.
Cryptocurrency is a decentralized digital financial asset that is transferred and traded on digitally secured networks using blockchain technology. Cryptocurrencies' growing popularity has brought with them a raft of new challenges. This has resulted in the creation of multiple platforms, each of which is constantly developing to bring solutions to those concerns.