Pages

Monday 27 April 2015

Drupal install by drush command

E:\xampp\htdocs\drupal>cd\

E:\>cd xampp

E:\xampp>mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N
O)

E:\xampp>mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.41 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database newdrupal;
Query OK, 1 row affected (0.00 sec)

mysql> ;
ERROR:
No query specified

mysql> exit;
Bye

E:\xampp>cd htdocs

E:\xampp\htdocs>cd drupal

E:\xampp\htdocs\drupal>drush si standard --account-name=admin --account-pass=adm
in --db-url=mysql://root:@localhost/newdrupal


You are about to create a sites/default/files directory and create a sites/defau
lt/settings.php file and DROP all tables in your 'newdrupal' database. Do you wa
nt to continue? (y/n): y
No tables to drop.                                                          [ok]

Starting Drupal installation. This takes a few seconds ...                  [ok]

Installation complete.  User name: admin  User password: admin              [ok]


E:\xampp\htdocs\drupal>


si = SITE-INSTALL
standard = INSTALLATION mode (second is manual)
account-name=admin
account-pass=admin
db-url=mysql://root:@localhost/newdrupal
 

Saturday 25 April 2015

SQL syntax for each of the SQL commands

Select Statement

SELECT "column_name" FROM "table_name"


Distinct
SELECT DISTINCT "column_name" FROM "table_name"


Where
SELECT "column_name" FROM "table_name" WHERE "condition"


And/or
SELECT "column_name" FROM "table_name" WHERE "simple condition" {[AND|OR] "simple condition"}


In
SELECT "column_name"
FROM "table_name"
WHERE "column_name" IN ('value1', 'value2', ...)


Between
SELECT "column_name"
FROM "table_name"
WHERE "column_name" BETWEEN 'value1' AND 'value2'


Like
SELECT "column_name"
FROM "table_name"
WHERE "column_name" LIKE {PATTERN}


Order By
SELECT "column_name"
FROM "table_name"
[WHERE "condition"]
ORDER BY "column_name" [ASC, DESC]


Count
SELECT COUNT("column_name")
FROM "table_name"


Group By
SELECT "column_name1", SUM("column_name2")
FROM "table_name"
GROUP BY "column_name1"


Having
SELECT "column_name1", SUM("column_name2") FROM "table_name" GROUP BY "column_name1" HAVING (arithmetic function condition)


Create Table Statement
CREATE TABLE "table_name" ("column 1" "data_type_for_column_1", "column 2" "data_type_for_column_2",... )


Drop Table Statement
DROP TABLE "table_name"


Truncate Table Statement
TRUNCATE TABLE "table_name"


Insert Into Statement
INSERT INTO "table_name" ("column1", "column2", ...) VALUES ("value1", "value2", ...)


Update Statement
UPDATE "table_name" SET "column_1" = [new value] WHERE {condition}



Delete From Statement
DELETE FROM "table_name" WHERE {condition}



Copy only the structure of an existing table into new table:

SELECT * INTO tbl_new FROM tbl_old WHERE 1=2;

Copy the structure and data of an existing table into new table:

SELECT * INTO tbl_new FROM tbl_old;