Scripts tagged with sql

1-10 of 11.

Create database and grant privileges to use

to sql mysql by aitzol , 1 comments

1 2 ...
create database database_name;
grant all on database_name.* to 'user_name'@'host_name' [identified by 'user_password']

filtrar resultados cuyo id esté en un conjunto dado

to django sql id by nando.quintana , 0 comments

1 2 3 ...
if distinct_ids != []:
   ids = "("+", ".join(distinct_ids)+")"
   commented_photos = Photo.objects.extra(where=['id IN '+ids])

Selects anidadas

to select sql by nando.quintana , 0 comments

1 2 3 4 5 ...
SELECT *
FROM erosketak_erosgaia e, erosketak_produktua p
WHERE e.erosgai_mota_id_id = p.mota_id
AND e.id NOT
IN (

Modify a bunch of registers in a MySQL table

to modify update mysql sql by nando.quintana , 0 comments

1 ...
 UPDATE `pasarteas` SET `zintaren_kodea` = 'ELG-022' WHERE `zintaren_kodea` = 'BER-123'

Create a user in a PostgreSQL Database

to user db postgresql sql by nando.quintana , 0 comments

1 2 3 4 ...
# su - postgres
# psql

CREATE USER username WITH PASSWORD 'password' CREATEDB CREATEUSER;

Create a user in a MySQL Database

to user db mysql sql by nando.quintana , 2 comments

1 2 4 5 6 ...
# su - mysql
# mysql
CREATE DATABASE databasename;
GRANT ALL PRIVILEGES ON databasename.* TO "user"@"hostname" IDENTIFIED BY "password";
FLUSH PRIVILEGES;

Retrieve a marc bib entry from koha

to koha marc sql by nando.quintana , 0 comments

1 2 3 ...
select tag, subfieldcode, subfieldvalue, tagorder, subfieldorder  
from marc_subfield_table where bibid = '565'
order by tag, tagorder, subfieldcode, subfieldorder;

Simple sql insert

to sql insert by windoze , 0 comments

1 2 ...
insert into bisitak (field1, field2, field3) 
values (v1,v2,v3)

parse MySQL log file

to python sql file parse stats by txus , 0 comments

1 2 4 5 6 ...
#Open the file
f = open('26.log','r')
#some variables
ITEMS = total_log_lines = TAGS = BOOL = SELECT = POWCounter = 0 
for s in f:

Different ways of retrieving a tag cloud

to sql tag cloud by nando.quintana , 0 comments

1 2 3 4 5 ...
-- http://poeticcode.wordpress.com/2007/01/27/tag-cloud-algorithmlogicformula/

select entity,metric from fact order by metric desc;
select entity,metric from fact ordre by metric desc limit 0,<n>;
select * from (select entity,metric from fact order by metric desc limit 0,<n>) order by entity;