Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql

SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index
Comment

sql

CREATE TABLE Customers (
    PersonID int,
    CustomerName varchar(255),
    ContactName varchar(255),
    Address varchar(255),
    City varchar(255),
    PostalCode varchar(255),
    Country varchar(255)
);

INSERT INTO Customers (1,CustomerName, ContactName, Address, City, PostalCode, Country)
VALUES ('Cardinal','Tom B. Erichsen','Skagen 21','Stavanger','4006','Norway');




-- after execution 
select * from Customers;

Comment

SQL

Let's create a database!
Comment

sql

Structured Query Language
Comment

SQL

CREATE TABLE friends (
   id INTEGER,
   name TEXT,
   birthday DATE
);

INSERT INTO friends (id, name, birthday) 
VALUES (1, 'Jane Doe', '1990-05-30');


INSERT INTO friends(id , name , birthday)
VALUES(2 , 'APOORV' , '2000-2-2');



UPDATE friends
SET name = 'Jane Srivastava'
WHERE id = 1;

ALTER TABLE friends 
ADD COLUMN email TEXT; 


UPDATE friends 
SET email =  '203029@klsafjls'
where id  = 1; 

UPDATE friends 
SET email =  '203029@klsafjls'
where id  = 2;

DELETE FROM friends 
WHERE id = 1;


SELECT * 
FROM friends;
Comment

sql

SQL - the standard language to communicate with DBMS.
Comment

sql

SQL is a domain-specific language used in programming and designed for managing
data held in a relational database management system, or for stream processing
in a relational data stream management system.
Comment

sql

https://medium.com/@sebastiandev
Comment

sql

SELECT * FROM STUDENT
Comment

SQL

create or replace view active_toys as
  select * from toys
  where is_deleted = 'N';

select * from active_toys;
Comment

sql

/****** Script for SelectTopNRows command from SSMS  ******/
SELECT *,isnull(pvt1.id,0) FROM(
SELECT id,date,relay_type,line_number,machine_number
,process,TIMES,time_val
FROM 
[OutputMonitoring].[dbo].[output_tbl] 

UNPIVOT(
time_val FOR times
IN
([0000HR],
 [0100HR])
) AS PV1

WHERE machine_number = 'CVR 9' and date = '2022-07-14'

)tb2

PIVOT (
    max(time_val)
    FOR TIMES IN ([0000HR],
 [0100HR])
)pvt1

FULL JOIN target_tbl
on
target_tbl.relay_type = pvt1.relay_type 
and target_tbl.line_no = pvt1.line_number
and target_tbl.machine_count = pvt1.machine_number
and target_tbl.process = pvt1.process
and target_tbl.Date = pvt1.date
WHERE pvt1.date = '2022-07-14'
Comment

SQL

select * 
from   toys
join   bricks
/* TODO */
on toy_id > brick_id;
Comment

SQL

select * 
from   toys, bricks
where  toy_id = brick_id (+);
Comment

SQL

select count ( all colour ) total_number_of_rows, 
       count ( distinct colour ) number_of_different_colours, 
       count ( unique colour ) number_of_unique_colours
from   bricks;
Comment

sql

BRICKS

COLOR    SHAPE      
green    cube       
yellow   prism      
red      cylinder   

COLORS

COLOR   RGB_HEX_VALUE   
red     FF0000          
green   00FF00          
blue    0000FF
Comment

SQL

select count ( colour ) from bricks;
Comment

SQL

select count (*) from bricks;
Comment

SQL

select count ( distinct colour ) number_of_different_colours
from   bricks;
Comment

SQL

SELECT
    -- Select the team long name and team API id
    team_long_name,
    team_api_id
FROM teams_germany
-- Only include FC Schalke 04 and FC Bayern Munich
WHERE team_long_name IN ('FC Schalke 04', 'FC Bayern Munich');
Comment

SQL

select colour, count (*) 
from   bricks
group  by colour;
Comment

SQL

select count (*) 
from   bricks
group  by colour;
Comment

SQL

select colour, shape, count (*) 
from   bricks
group  by colour;
Comment

SQL

select colour, count (*)
from   bricks
where  count (*) > 1
group  by colour;
Comment

SQL

select colour, count (*)
from   bricks
group  by colour
having count (*) > 1;

select colour, count (*) 
from   bricks
having count (*) > 1
group  by colour;
Comment

SQL

select * 
from   toys
join   bricks
/* TODO */ on toy_id > brick_id;
Comment

SQL

-- Select the season, date, home_goal, and away_goal columns
SELECT 
    season,
    date,
    home_goal,
    away_goal
FROM matches_italy
WHERE 
-- Exclude games not won by Bologna
    CASE
        WHEN hometeam_id = 9857 AND home_goal > away_goal THEN 'Bologna Win'
        WHEN awayteam_id = 9857 AND away_goal > home_goal THEN 'Bologna Win'     
    END 【IS NOT NULL】;
Comment

SQL

SHAPE    SHAPE_WEIGHT   
cube	            5
cuboid	            1
pyramid	            4
Comment

SQL

select * 
from   toys
left   outer join bricks
on     toy_id = brick_id;
Comment

SQL

select * 
from   toys, bricks
where  toy_id = brick_id;
Comment

SQL

TOY_ID   TOY_NAME      TOY_COLOUR   BRICK_ID   BRICK_COLOUR   BRICK_SHAPE   
       3 Baby Turtle   green                 2 blue           cube
Comment

SQL

select toy_name
from   toys
where  /* TODO */ not colour = 'green';
Comment

SQL

select *
from   toys 
where  not colour = 'green';
Comment

SQL

select * from toys
where  price = null;
Comment

SQL

select * from toys
where  price is null;
Comment

SQL

select *
from  toys 
where colour <> 'green';
Comment

SQL

select *
from   toys 
where  not colour = null;

select *
from   toys 
where  colour <> null;
Comment

SQL

select *
from   toys 
where  colour is not null;
Comment

SQL

select toy_name
from   toys
where  /* TODO */not colour = 'green'
and not price = 6; 
Comment

SQL

select * 
from   toys
join   bricks
/* TODO */ on toy_id = brick_id 
Comment

SQL

select * from toys;

select * from bricks;
Comment

SQL

select * 
from   toys, bricks;
Comment

SQL

select * 
from   toys
cross join bricks;
Comment

SQL

SHAPE    SUM(WEIGHT)   
cuboid             1
Comment

SQL

select * 
from   toys
inner  join bricks
on     toy_id = brick_id;
Comment

SQL

select * 
from   toys
join   bricks
on     toy_colour = brick_colour;
Comment

SQL

select * 
from   toys
join   bricks
on     toy_colour <> brick_colour;
Comment

SQL

select colour, count (*) 
from   bricks
having sum ( weight ) > 1
group  by colour;
Comment

SQL

insert into <table_name> ( col1, col2, ... )
  values ( 'value1', 'value2', ... )
Comment

SQL

select colour, shape, count (*)
from   bricks
group  by cube ( colour, shape );
Comment

SQL

SELECT EmpId FROM 
EmployeeDetails 
where EmpId IN 
(SELECT EmpId FROM EmployeeSalary);
Comment

SQL

alter session set row archival visibility = active;

select * from toys;
Comment

sql

SQL (Structured Query Language)
Comment

sql

// Connect to the database.
Connection conn = DriverManager.getConnection(URL, USER, PASS);

// Construct the SQL statement we want to run, specifying the parameter.
String sql = "SELECT * FROM users WHERE email = ?";

// Generate a prepared statement with the placeholder parameter.
PreparedStatement stmt = conn.prepareStatement(sql);

// Bind email value into the statement at parameter index 1.
stmt.setString(1, email);

// Run the query...
ResultSet results = stmt.executeQuery(sql);

while (results.next())
{
    // ...do something with the data returned.
}
Comment

SQL

String firstname = req.getParameter("firstname");
String lastname = req.getParameter("lastname");
// FIXME: do your own validation to detect attacks
String query = "SELECT id, firstname, lastname FROM authors WHERE firstname = ? and lastname = ?";
PreparedStatement pstmt = connection.prepareStatement( query );
pstmt.setString( 1, firstname );
pstmt.setString( 2, lastname );
try
{
    ResultSet results = pstmt.execute( );
}
Comment

sql

CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `username` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Comment

SQL

SELECT
concat('<a target="_new" href=%%WWWROOT%%/course/view.php?id=',c.id,'">',c.fullname,'</a>') AS Course
,c.shortname,r.name
,(SELECT CONCAT(u.firstname,' ', u.lastname) AS Teacher
FROM prefix_role_assignments AS ra
JOIN prefix_context AS ctx ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher
,concat('<a target="_new" href="%%WWWROOT%%/mod/resource/view.php?id=',r.id,'">',r.name,'</a>') AS Resource
FROM prefix_resource AS r
JOIN prefix_course AS c ON r.course = c.id
WHERE r.reference LIKE 'https://stackoverflow.com/%'	



Comment

SQL

# Hello World in SQL

SELECT 'Hello World';
Comment

SQL

create table toys (
  toy_name varchar2(30),
  price    number(4, 2)
);

insert into toys values ('Baby Turtle', 0.01);
insert into toys values ('Miss Snuggles', 0.51);
insert into toys values ('Cuteasaurus', 10.01);
insert into toys values ('Sir Stripypants', 14.03);
insert into toys values ('Purple Ninja', 14.22);

commit;
Comment

sql

SQL(Structured Query Language ) is a domain-specific 
language used in programming and designed for 
managing data held in a relational database management system, 
or for stream processing in a relational data stream management system.
Comment

sql

SELECT name, population/area AS density FROM bbc WHERE population = (SELECT MAX(population) FROM bbc)
Comment

sql

select * from db
Comment

sql

Structured Query Language (SQL) is a programming language released in 1974. 
It is used to manage relational databases and perform various operations on them.
I would recommend Docker to run SQL servers locally. 
MySQL would recommend as well.
Flask is good for SQLite development.
Comment

SQL

Structured Query Language (SQL)
Comment

SQL

SELECT id, payer_email
FROM paypal_ipn_orders
WHERE payer_email IN (
    SELECT payer_email
    FROM paypal_ipn_orders
    GROUP BY payer_email
    HAVING COUNT(id) > 1
)
Comment

sql

 <tr>
    <td>Emp ID:</td>
    <td><input type="text" name="EmpID"></td>
    </tr>
   <tr>
    <td>First Name:</td>
    <td><input type="text" name="Firstname"></td>
    </tr>
	<tr>
    <td>Middle Name:</td>
    <td><input type="text" name="Middlename"></td>
    </tr>
	<tr>
    <td>Last Name:</td>
    <td><input type="text" name="Lastname"></td>
    </tr>
	<tr>
    <td>Department:</td>
    <td><input type="text" name="Department"></td>
    </tr>
	<tr>
    <td>Age:</td>
    <td><input type="text" name="Age"></td>
    </tr>
    <tr>
    <td>Brith Year :</td>
    <td>
    <select name="BrithYear>
     <option selected hidden value="">select code</option>
    <option> 1980    </option>
	<option> 1985    </option>
	<option> 1990    </option>
	<option> 1995    </option>
	</td>
	</tr>
	 <tr>
    <td>Education Status :</td>
    <td>
    <select name="Education Status>
     <option selected hidden value="">select code</option>
    <option> Level   </option>
	<option>  Diploma  </option>
	<option> B.A Degree   </option>
	<option> M/r   </option>
	</td>
	</tr>
	<tr>
    <td>Date of Emp :</td>
    <td>
    <select name="Date of Emp >
     <option selected hidden value="">select code</option>
    <option>  01  </option>
	<option>  05   </option>
	<option>  10 </option>
	<option>  20  </option>
	</td>
	</tr>
	<tr>
    <td>Month of Emp :</td>
    <td>
    <select name="Month of Emp >
    <option selected hidden value="">select code</option>
    <option>   01  </option>
	<option>   05  </option>
	 <option>  08  </option>
	<option>   10  </option>
	</td>
	</tr>
	<tr>
    <td>Year of Emp :</td>
    <td>
    <select name="Year of Emp >
    <option selected hidden value="">select code</option>
    <option>2010    </option>
	<option>2015    </option>
	<option>2020    </option>
	<option>2022    </option>
	</td>
	</tr>
	<tr>
    <td>Marriage Status :</td>
    <td>
    <select name="Marriage Status >
    <option selected hidden value="">select code</option>
    <option> SINGLE  </option>
	<option> NO  </option>
	<option> yES  </option>
	</td>
	</tr>
	<tr>
    <td>Type of Emp :</td>
    <td>
    <select name="Type of Emp >
    <option selected hidden value="">select code</option>
    <option>Daily    </option>
	<option>Extension    </option>
	<option>Weekend    </option>
    <tr>
    <td>Gender :</td>
    <td>
    <input type="radio" name="gender" value="m">Male
    <input type="radio" name="gender" value="f">Female
    </td>
    </tr>
  
    <tr>
    <td>phone no :</td>
    <td>
    <select name="phoneCode>
     <option selected hidden value="">select code</option>
    <option>+251</option>
    <option>+251</option>
    <option>979</option>
    <option>973</option>
    <option>972</option>
    <option>974</option> 
   </select>
   <input type="phone">
   </td>
   </tr>
   <tr>
    <td>Salary:</td>
    <td><input type="text" name="Salary"></td>
    </tr>
   <tr>
    <tr>
     <td><input type="submit" value="submit"></td>
    </tr>
	<tr>
     <td><input type="Reset" value="Reset"></td>
    </tr>
Comment

SQL

alter session set row archival visibility = all;

select * from toys;
Comment

SQL

alter table bricks add ( version_number integer default 1 );

select * from bricks;
Comment

SQL

COLOR   SHAPE               
blue    cube                
blue    cylinder            
green   cube                
red     cylinder            
red     rectangular cuboid  
yellow  rectangular cuboid
Comment

SQL

select * from toys;

insert into bricks ( brick_id )
  select toy_id
  from   toys;

select * from bricks;
Comment

SQL

create table toys (
  toy_id   integer,
  toy_name varchar2(100),
  colour   varchar2(10)
);

create table bricks (
  brick_id integer,
  colour   varchar2(10),
  shape    varchar2(10)
);
Comment

SQL

select * from toys;

select * from bricks;

select table_name, column_name, data_type
from   user_tab_columns
where  table_name in ( 'TOYS', 'BRICKS' )
order  by table_name, column_id
Comment

SQL

select * from toys
where  toy_name like '%_%';
Comment

SQL

insert into toys values ( 1, 'Miss Snuggles', 'pink' );

select * from toys;
Comment

SQL

insert into toys ( toy_id, toy_name ) values ( 2, 'Baby Turtle' );

select * from toys;
Comment

SQL

insert into toys values ( 2, 'Baby Turtle' );
Comment

SQL

TOY_ID   TOY_NAME   COLOUR   
       3 <null>     red
Comment

SQL

insert into toys ( toy_id, colour ) values ( 4, 'blue' );
insert into toys ( toy_id, colour ) values ( 5, 'green' );
Comment

SQL

select * from bricks
where  colour = 'red'
for    update;
Comment

SQL

BRICK_ID	COLOUR	SHAPE
       4	blue	<null>
       5	green	<null>
Comment

SQL

insert into toys ( toy_id, toy_name, colour ) 
  values ( 7, 'Pink Rabbit', 'pink' );

select * from toys
where  toy_id = 7;

commit;
rollback;

select * from toys
where  toy_id = 7;
Comment

SQL

insert into toys ( toy_id, toy_name, colour ) 
  values ( 7, 'Pink Rabbit', 'pink' );

select * from toys
where  toy_id = 7;

rollback;

select * from toys
where  toy_id = 7;
Comment

sql

mysql> CREATE TABLE char_test( char_col CHAR(10));
mysql> INSERT INTO char_test(char_col) VALUES
    -> ('string1'), ('  string2'), ('string3 ');
Comment

sql

~/ $ sqlite3
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
sqlite> .mode csv
sqlite> .import 'Favorite TV Shows (Responses) - Form Responses 1.csv' shows
Comment

SQL

COLUMN_NAME   DATA_TYPE   DATA_LENGTH   DATA_PRECISION   DATA_SCALE   
TOY_ID        NUMBER                 22           <null>            0 
TOY_NAME      VARCHAR2              100           <null>       <null> 
WEIGHT        NUMBER                 22                8            1
Comment

SQL

create table toys (
  /* TODO */ varchar2(10)
);

select column_name, data_type, data_length
from   user_tab_columns
where  table_name = 'TOYS';
Comment

SQL

select toy_name
from   toys
where  /* TODO */ toy_name LIKE '%B%';
Comment

SQL

select *
from   toys
where  /* TODO */ colour in ('blue','red')
and price >= 6 and price < 14.22;
Comment

SQL

select * from toys
where  colour like '_e_';

select * from toys
where  colour like '%e%';

select * from toys
where  colour like '%_e_%';
Comment

SQL

select table_name, iot_name, iot_type, external, 
       partitioned, temporary, cluster_name
from   user_tables;
Comment

sql

python sqlmap.py -h
Comment

sql

Dont even try it
Comment

SQL

create table people (
  person_id integer,
  full_name varchar2(100)
);
Comment

SQL

create table appointments (
  appointment_doc varchar2(4000)
);
Comment

SQL

create table <table_name> (
  <column1_name> <data_type>,
  <column2_name> <data_type>,
  <column3_name> <data_type>,
  ...
)
Comment

SQL

create table toys (
  toy_name varchar2(100),
  weight   number
);
Comment

SQL

create table toys_heap (
  toy_name varchar2(100)
) organization heap;

select table_name, iot_name, iot_type, external, 
       partitioned, temporary, cluster_name
from   user_tables
where  table_name = 'TOYS_HEAP';
Comment

SQL

create table bricks (
  /* TODO */
  brick_id number(20,0),
  colour varchar2(10),
  price number(10,2),
  purchased_date date
);

select column_name, data_type, data_length, data_precision, data_scale
from   user_tab_columns
where  table_name = 'BRICKS';
Comment

SQL

create table toys_iot (
  toy_id   integer primary key,
  toy_name varchar2(100)
) organization index;
Comment

SQL

select table_name, iot_type
from   user_tables
where  table_name = 'TOYS_IOT';
Comment

SQL

create or replace directory toy_dir as '/path/to/file';

create table toys_ext (
  toy_name varchar2(100)
) organization external (
  default directory tmp
  location ('toys.csv')
);
Comment

SQL

/path/to/file/toys.csv
Comment

SQL

create global temporary table toys_gtt (
  toy_name varchar2(100)
);
Comment

SQL

create private temporary table ora$ptt_toys (
  toy_name varchar2(100)
);
Comment

SQL

create table toys_part_iot (
  toy_id   integer primary key,
  toy_name varchar2(100)
) organization index 
  partition by hash ( toy_id ) partitions 4;
Comment

sql

python sqlmap.py -hh
Comment

SQL

create table toys (
  toy_name /* TODO */ varchar2(10)
);

select column_name, data_type, data_length
from   user_tab_columns
where  table_name = 'TOYS';
Comment

SQL

TABLE_NAME    PARTITIONED   
BRICKS_HASH   YES
Comment

SQL

Structured Query Language is a database communiacation language. It manages data
in a database and processes a relational data stream in a management system.
Comment

sql

SQL is used to communicate with a database.
According to ANSI (American National Standards Institute), it is the standard language for relational database management systems.
SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database.
Comment

sql

Download XAMPP
Comment

sql

DOWNLOAD XAMPP
And then start apache and mysql then go to localhost/phpmyadmin
Comment

sql

INSERT into table_ values()
Comment

sql

--
-- Procedures
--
CREATE DEFINER=`root`@`localhost` PROCEDURE `business_registration` (IN `bscode` VARCHAR(10), IN `bsname` VARCHAR(50), IN `appcode` VARCHAR(10), IN `in_state` VARCHAR(25), IN `in_sector` VARCHAR(50), IN `in_cac` VARCHAR(10), IN `dobinc` DATE, IN `fname` VARCHAR(100), IN `phone` VARCHAR(20), IN `in_email` VARCHAR(20), IN `biz_add` VARCHAR(50), IN `app_status` VARCHAR(10), IN `in_id` INT, IN `query_type` VARCHAR(30))  NO SQL
Begin
if query_type="insert" THEN
INSERT INTO `business_registration`(`business_code`, `business_name`, `application_code`, `state`, `sector`, `cac_registration`, `date_of_biz_incorporation`, `founders_name`, `phone_number`, `email`, `biz_address`, `application_status`) VALUES (bscode,bsname,appcode,in_state,in_sector,in_cac,dobinc,fname,phone,in_email,biz_add,app_status);

ELSEIF query_type="delete" THEN
DELETE FROM business_registration where id=in_id;

ELSEIF query_type="select_all" THEN
SELECT * FROM business_registration;

ELSEI[...]
Comment

sql

CREATE TABLE consultation (
  id SERIAL,
  Identification VARCHAR(50),
  Coord_X INT,
  Coord_Y INT,
  PRIMARY KEY (Identification)
)
Comment

sql

Codecademy has a free course on this.
https://www.codecademy.com/learn/learn-sql
Comment

sql

TABLE a  bills
  id q  INTEGER x  NOT k  NULL d  PRIMARY n  KEY
  customerName u  VARCHAR(50) s  NOT 5  NULL

TABLE 1  billItems
  id b  INTEGER r  NOT g  NULL 9  PRIMARY n  KEY
  name g  VARCHAR(50) 9  NOT f  NULL
  amountDollars v  DECIMAL(10, n  2) 5  NOT 7  NULL
 m   g  discountDollars r  DECIMAL(10, b  2) q  NOT t  NULL
  billId 8  INTEGER t  NOT y  NULL p  REFERENCES 1  bill(id)
Comment

SQL

drop table /*TODO*/ toys ;

select table_name
from   user_tables
where  table_name = 'TOYS';
Comment

sql

select username, high_score from users;
Comment

SQL

create table bricks (
  /*TODO*/
  Colour varchar2(10),
  Shape varchar2(10)
);

select table_name
from   user_tables
where  table_name = 'BRICKS';
Comment

SQL

create table bricks_iot (
  bricks_id integer primary key
) /*TODO*/organization index;

select table_name, iot_type
from   user_tables
where  table_name = 'BRICKS_IOT';
Comment

sql

SQL (Structured Query Language) is a standardized programming language 
that's used to manage relational databases and perform various 
operations on the data in them.
Comment

SQL

create table bricks_iot (
  bricks_id integer primary key
) /*TODO*/ organization index;

select table_name, iot_type
from   user_tables
where  table_name = 'BRICKS_IOT';
Comment

SQL

select table_name, temporary
from   user_tables
where  table_name in ( 'TOYS_GTT', 'ORA$PTT_TOYS' );
Comment

SQL

create table bricks_hash (
  brick_id integer
) partition by /*TODO*/ hash (brick_id) partitions 8;

select table_name, partitioned 
from   user_tables
where  table_name = 'BRICKS_HASH';
Comment

SQL

select table_name, partitioned 
from   user_tables
where  table_name in ( 'TOYS_HASH', 'TOYS_LIST', 'TOYS_RANGE', 'TOYS_PART_IOT' );

select table_name, partition_name
from   user_tab_partitions;
Comment

SQL

create cluster toy_cluster (
  toy_name varchar2(100)
);
Comment

SQL

select * from toys
where  toy_name like '___________';
Comment

SQL

select * from toys
where  colour in ( 'red' , 'green' );
Comment

SQL

select * from toys
where  ( toy_name = 'Mr Bunnykins' or toy_name = 'Baby Turtle' )
and    colour = 'green';

select * from toys
where  colour = 'green'
and    ( toy_name = 'Mr Bunnykins' or toy_name = 'Baby Turtle' );
Comment

SQL

select *
from   toys
where  /* TODO */ toy_name = 'Sir Stripypants'
or colour = 'blue';
Comment

SQL

select *
from   toys
where  /* TODO */ toy_name = 'Sir Stripypants'
or colour = 'blue'
and price = 6;
Comment

SQL

select *
from   toys
where  /* TODO */ (toy_name = 'Sir Stripypants'
or colour = 'blue')
and price = '6';
Comment

SQL

TOY_NAME            COLOUR   PRICE   
Miss Smelly_bottom  blue	 6
Comment

SQL

select * from toys
where  colour = 'red' or
       colour = 'green';
Comment

SQL

select * from toys
where  price < 10;
Comment

SQL

select * from toys
where  toy_name = 'Mr Bunnykins' or toy_name = 'Baby Turtle'
and    colour = 'green';

select * from toys
where  colour = 'green'
and    toy_name = 'Mr Bunnykins' or toy_name = 'Baby Turtle';
Comment

SQL

select * from toys
where  price >= 6;
Comment

SQL

select * from toys
where  price between 6 and 20;
Comment

SQL

select * from toys
where  price >= 6
and    price <= 20;
Comment

SQL

select * from toys
where  price > 6 
and    price <= 20;
Comment

SQL

TOY_NAME             COLOUR   PRICE    
Miss Smelly_bottom   blue         6
Comment

SQL

select * from toys
where  colour like 'b%';
Comment

SQL

select * from toys
where  colour like '%n';
Comment

SQL

PRICE    COLOUR   
    0.01 red      
       6 blue     
   17.22 blue     
   14.22 red      
  <null> green
Comment

SQL

select * from toys
where  toy_name = 'Sir Stripypants'
and    colour = 'green';
Comment

PREVIOUS NEXT
Code Example
Sql :: CREATE table schema using select 
Sql :: asp.net core sql server stored procedure 
Sql :: float vs decimal sql 
Sql :: like operator in sql 
Sql :: load a log file in that format into MySQL 
Sql :: compare if is null sql 
Sql :: year format in date mysql 
Sql :: SELECT SQL LIKE 
Sql :: new rails app with mysql 
Sql :: sql check 
Sql :: call rest api from postgresql 
Sql :: sqlite3.OperationalError: near "WHERE": syntax error 
Sql :: sql where statement 
Sql :: 18446744073709551615 mariadb left join order by 
Sql :: increase space oracle aws instance 
Sql :: MySql count occurences more than" 
Sql :: oracle activate program 
Sql :: delete and start from 1 primary key muysql 
Sql :: can we rollback data that are deleted using delete clause? 
Sql :: default column value in sql same as other column 
Sql :: what is server_default = func.now() in sqlalchemy 
Sql :: query archive mode 
Sql :: sqlalchemy database uri 
Sql :: how to use multiple transactions in sql server 
Sql :: Search In the Data using ObjectName 
Sql :: Components/Fields of Internal Table 
Sql :: REFRESH command materialized view pgadmin example 
Sql :: ERROR: column "hourly_visitors.hour" must appear in the GROUP BY clause or be used in an aggregate function 
Sql :: cara menampilkan tabel yang tidak mengandung kata di sql server 
Sql :: alembic upgrade show sql 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =