Skip to content

Instantly share code, notes, and snippets.

View operateur-mar's full-sized avatar

Rida Dahhane operateur-mar

View GitHub Profile
<?php
/* Create Database configuration */
$server = "localhost";
$username = "root";
$password = "";
$database = "Library";
/* Begin Connection */
try{
/* Setup PDO Connection */
/* Query N° 8 : Get customers with Ahmed or Rida as a name */
select * from customer where LN='Ahmed' or LN='Rida'
/* Query n° 7 : Select users with Ahmed as name AND zipCode 28932 */
select * from customer where LN = 'Ahmed' and zipCode = 28932
/* Query N° 6 : Select customers with 'Ahmed' as name */
Select * from customer where LN = 'Ahmed'
/* Query n° 5 : Select Distinct */
SELECT DISTINCT type from orders
/* Change Type column to thetime */
ALTER TABLE orders CHANGE COLUMN type thetime varchar(50);
/* Change time column to Type */
ALTER TABLE orders CHANGE COLUMN time type varchar(50);
/* Query N° 3 : Select from table using Alias */
SELECT custID as ' ID Client ', LN as ' Last Name ', FN as ' First Name ' from customer
/* Query N° 2 : Select Customized fields from table */
Select custID,LN,FN from customer
/* First Query : Select all data from table */
Select * from customer
INSERT into orders values
(1,1,'9/29/2018','14:02','reuglar order'),
(2,1,'9/29/2018','14:30','reuglar order'),
(3,3,'9/29/2018','17:22','Big Meal order')