亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? basics.py

?? 關系型數據庫 Postgresql 6.5.2
?? PY
字號:
#! /usr/local/bin/python# basics.py - basic SQL commands tutorial# inspired from the Postgres95 tutorial # adapted to Python 1995 by Pascal ANDREprint "__________________________________________________________________"print "MODULE BASICS.PY : BASIC SQL COMMANDS TUTORIAL"printprint "This module is designed for being imported from python prompt"printprint "In order to run the samples included here, first create a connection"print "using :                        cnx = basics.DB(...)"print "then start the demo with:      basics.demo(cnx)"print "__________________________________________________________________"from pg import DBfrom pgtools import *# table creation commandsdef create_table(pgcnx):	print "-----------------------------"	print "-- Creating a table:"	print "--	a CREATE TABLE is used to create base tables. POSTGRES"	print "--	SQL has its own set of built-in types. (Note that"	print "--	keywords are case-insensitive but identifiers are "	print "--	case-sensitive.)"	print "-----------------------------"	print	print "Sending query :"	print "CREATE TABLE weather ("        print "    city            varchar(80),"        print "    temp_lo         int,"        print "    temp_hi         int,"        print "    prcp            float8,"        print "    date            date"        print ")"        pgcnx.query("CREATE TABLE weather (city varchar(80), temp_lo int," \		"temp_hi int, prcp float8, date date)")	print	print "Sending query :"	print "CREATE TABLE cities ("	print "    name		varchar(80),"	print "    location	point"	print ")"	pgcnx.query("CREATE TABLE cities ("	\		"name		varchar(80),"	\		"location	point)")# data insertion commandsdef insert_data(pgcnx):	print "-----------------------------"	print "-- Inserting data:"	print "--	an INSERT statement is used to insert a new row into"	print "--       a table. There are several ways you can specify what"	print "--	 columns the data should go to."	print "-----------------------------"	print	print "-- 1. the simplest case is when the list of value correspond to"	print "--    the order of the columns specified in CREATE TABLE."	print	print "Sending query :"	print "INSERT INTO weather "	print "   VALUES ('San Francisco', 46, 50, 0.25, '11/27/1994')"	pgcnx.query("INSERT INTO weather "	\		"VALUES ('San Francisco', 46, 50, 0.25, '11/27/1994')")	print	print "Sending query :"	print "INSERT INTO cities "	print "   VALUES ('San Francisco', '(-194.0, 53.0)')"	pgcnx.query("INSERT INTO cities "	\		"VALUES ('San Francisco', '(-194.0, 53.0)')")	print	wait_key()	print "-- 2. you can also specify what column the values correspond "	print "     to. (The columns can be specified in any order. You may "	print "     also omit any number of columns. eg. unknown precipitation"	print "     below)"	print "Sending query :"	print "INSERT INTO weather (city, temp_lo, temp_hi, prcp, date)"	print "   VALUES ('San Francisco', 43, 57, 0.0, '11/29/1994')"	pgcnx.query("INSERT INTO weather (date, city, temp_hi, temp_lo)" \		"VALUES ('11/29/1994', 'Hayward', 54, 37)")# direct selection commandsdef select_data1(pgcnx):	print "-----------------------------"	print "-- Retrieving data:"	print "--	a SELECT statement is used for retrieving data. The "	print "--	basic syntax is:"	print "--		SELECT columns FROM tables WHERE predicates"	print "-----------------------------"	print	print "-- a simple one would be the query:"	print "SELECT * FROM weather"	print 	print "The result is :"	q = pgcnx.query("SELECT * FROM weather")	print q	print	print "-- you may also specify expressions in the target list (the "	print "-- 'AS column' specifies the column name of the result. It is "	print "-- optional.)"	print "The query :"	print "   SELECT city, (temp_hi+temp_lo)/2 AS temp_avg, date "	print "   FROM weather"	print "Gives :"	print pgcnx.query("SELECT city, (temp_hi+temp_lo)/2 "	\		"AS temp_avg, date FROM weather")	print	print "-- if you want to retrieve rows that satisfy certain condition"	print "-- (ie. a restriction), specify the condition in WHERE. The "	print "-- following retrieves the weather of San Francisco on rainy "	print "-- days."	print "SELECT *"	print "FROM weather"	print "WHERE city = 'San Francisco' "	print "  and prcp > 0.0"	print pgcnx.query("SELECT * FROM weather WHERE city = 'San Francisco'" \		" AND prcp > 0.0")	print	print "-- here is a more complicated one. Duplicates are removed when "	print "-- DISTINCT is specified. ORDER BY specifies the column to sort"	print "-- on. (Just to make sure the following won't confuse you, "	print "-- DISTINCT and ORDER BY can be used separately.)"	print "SELECT DISTINCT city"	print "FROM weather"	print "ORDER BY city;"	print pgcnx.query("SELECT DISTINCT city FROM weather ORDER BY city")# selection to a temporary tabledef select_data2(pgcnx):	print "-----------------------------"	print "-- Retrieving data into other classes:"	print "--	a SELECT ... INTO statement can be used to retrieve "	print "--	data into another class."	print "-----------------------------"	print 	print "The query :"	print "SELECT * INTO TABLE temp "	print "FROM weather"	print "WHERE city = 'San Francisco' "	print "  and prcp > 0.0"	pgcnx.query("SELECT * INTO TABLE temp FROM weather " \		"WHERE city = 'San Francisco' and prcp > 0.0")	print "Fills the table temp, that can be listed with :"	print "SELECT * from temp"	print pgcnx.query("SELECT * from temp")# aggregate creation commandsdef create_aggregate(pgcnx):	print "-----------------------------"	print "-- Aggregates"	print "-----------------------------"	print	print "Let's consider the query :"	print "SELECT max(temp_lo)"	print "FROM weather;"	print pgcnx.query("SELECT max(temp_lo) FROM weather")	print 	print "-- Aggregate with GROUP BY"	print "SELECT city, max(temp_lo)"	print "FROM weather "	print "GROUP BY city;"	print pgcnx.query( "SELECT city, max(temp_lo)"	\		"FROM weather GROUP BY city")# table join commandsdef join_table(pgcnx):	print "-----------------------------"	print "-- Joining tables:"	print "--	queries can access multiple tables at once or access"	print "--	 the same table in such a way that multiple instances"	print "--	of the table are being processed at the same time."	print "-----------------------------"	print	print "-- suppose we want to find all the records that are in the "	print "-- temperature range of other records. W1 and W2 are aliases "	print "--for weather."	print	print "SELECT W1.city, W1.temp_lo, W1.temp_hi, "	print "    W2.city, W2.temp_lo, W2.temp_hi"	print "FROM weather W1, weather W2"	print "WHERE W1.temp_lo < W2.temp_lo "	print "  and W1.temp_hi > W2.temp_hi"	print	print pgcnx.query("SELECT W1.city, W1.temp_lo, W1.temp_hi, " \		"W2.city, W2.temp_lo, W2.temp_hi FROM weather W1, weather W2 "\		"WHERE W1.temp_lo < W2.temp_lo and W1.temp_hi > W2.temp_hi")	print	print "-- let's join two tables. The following joins the weather table"	print "-- and the cities table."	print	print "SELECT city, location, prcp, date"	print "FROM weather, cities"	print "WHERE name = city"	print	print pgcnx.query("SELECT city, location, prcp, date FROM weather, cities"\		" WHERE name = city")	print	print "-- since the column names are all different, we don't have to "	print "-- specify the table name. If you want to be clear, you can do "	print "-- the following. They give identical results, of course."	print	print "SELECT w.city, c.location, w.prcp, w.date"	print "FROM weather w, cities c"	print "WHERE c.name = w.city;"	print	print pgcnx.query("SELECT w.city, c.location, w.prcp, w.date " \		"FROM weather w, cities c WHERE c.name = w.city")# data updating commandsdef update_data(pgcnx):	print "-----------------------------"	print "-- Updating data:"	print "--	an UPDATE statement is used for updating data. "	print "-----------------------------"	print 	print "-- suppose you discover the temperature readings are all off by"	print "-- 2 degrees as of Nov 28, you may update the data as follow:"	print	print "UPDATE weather"	print "  SET temp_hi = temp_hi - 2,  temp_lo = temp_lo - 2"	print "  WHERE date > '11/28/1994'"	print	pgcnx.query("UPDATE weather "	\		"SET temp_hi = temp_hi - 2,  temp_lo = temp_lo - 2" \		"WHERE date > '11/28/1994'")	print	print "SELECT * from weather"	print pgcnx.query("SELECT * from weather")# data deletion commandsdef delete_data(pgcnx):	print "-----------------------------"	print "-- Deleting data:"	print "--	a DELETE statement is used for deleting rows from a "	print "--	table."	print "-----------------------------"	print	print "-- suppose you are no longer interested in the weather of "	print "-- Hayward, you can do the following to delete those rows from"	print "-- the table"	print	print "DELETE FROM weather WHERE city = 'Hayward'"	pgcnx.query("DELETE FROM weather WHERE city = 'Hayward'")	print	print "SELECT * from weather"	print	print pgcnx.query("SELECT * from weather")	print	print "-- you can also delete all the rows in a table by doing the "	print "-- following. (This is different from DROP TABLE which removes "	print "-- the table in addition to the removing the rows.)"	print	print "DELETE FROM weather"	pgcnx.query("DELETE FROM weather")	print	print "SELECT * from weather"	print pgcnx.query("SELECT * from weather")# table removal commandsdef remove_table(pgcnx):	print "-----------------------------"	print "-- Removing the tables:"	print "--	DROP TABLE is used to remove tables. After you have"	print "--	done this, you can no longer use those tables."	print "-----------------------------"	print	print "DROP TABLE weather, cities, temp"	pgcnx.query("DROP TABLE weather, cities, temp")# main demo functiondef demo(pgcnx):	create_table(pgcnx)	wait_key()	insert_data(pgcnx)	wait_key()	select_data1(pgcnx)	select_data2(pgcnx)	create_aggregate(pgcnx)	join_table(pgcnx)	update_data(pgcnx)	delete_data(pgcnx)	remove_table(pgcnx)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕视频一区| 精品国产不卡一区二区三区| 成人亚洲精品久久久久软件| 久久99国产精品尤物| 美日韩黄色大片| 精品亚洲免费视频| 国产成人日日夜夜| 99久久免费精品| 在线免费视频一区二区| 欧美在线啊v一区| 欧美日韩国产色站一区二区三区| 欧美色爱综合网| 欧美日韩国产另类一区| 欧美一区二区三区系列电影| 精品国产乱码久久久久久图片| 精品嫩草影院久久| 国产日韩精品一区二区浪潮av| 国产日产亚洲精品系列| 亚洲免费大片在线观看| 水野朝阳av一区二区三区| 秋霞电影网一区二区| 国产成人亚洲综合a∨猫咪| 97久久久精品综合88久久| 欧美日本在线视频| 2023国产精品视频| 亚洲免费三区一区二区| 奇米影视一区二区三区小说| 成人动漫在线一区| 欧美视频精品在线| 久久青草国产手机看片福利盒子 | 欧美日韩高清影院| 日韩一区二区三区av| 国产丝袜欧美中文另类| 一个色在线综合| 经典三级一区二区| 色av一区二区| 亚洲精品在线三区| 亚洲国产精品麻豆| 国产成人av网站| 日韩欧美亚洲一区二区| |精品福利一区二区三区| 免费观看一级特黄欧美大片| 成人97人人超碰人人99| 日韩欧美综合一区| 亚洲综合色视频| www.亚洲免费av| 精品国产三级电影在线观看| 亚洲成人av中文| jlzzjlzz国产精品久久| 欧美精品一区二区三区视频 | 欧美成人女星排行榜| 一区二区三区国产精品| 成人18精品视频| 欧美国产1区2区| 免费在线观看一区| 欧美色图免费看| 最新高清无码专区| 成人免费毛片aaaaa**| 精品999在线播放| 麻豆91免费看| 欧美精品 日韩| 亚洲国产日韩a在线播放| 色婷婷激情综合| 亚洲手机成人高清视频| 成人免费高清在线| 国产女同性恋一区二区| 国产最新精品免费| 久久精品亚洲一区二区三区浴池| 日日摸夜夜添夜夜添国产精品| 色婷婷综合久久久久中文一区二区| 欧美激情一区二区三区四区| 国产传媒日韩欧美成人| 国产日产欧产精品推荐色| 国产主播一区二区| 久久婷婷国产综合国色天香| 国产一区二区在线视频| 久久免费看少妇高潮| 国产在线国偷精品免费看| 久久综合丝袜日本网| 国产精品一区二区三区网站| 久久久无码精品亚洲日韩按摩| 国产成人综合网| 亚洲欧美综合另类在线卡通| 97精品超碰一区二区三区| 亚洲男人天堂av| 91.xcao| 毛片av一区二区| 国产欧美一区二区三区在线老狼| 国产成人在线影院| 一区二区三区四区国产精品| 欧美女孩性生活视频| 理论电影国产精品| 国产日韩欧美综合一区| 色婷婷久久久综合中文字幕| 五月婷婷另类国产| 久久久777精品电影网影网| 91小视频在线免费看| 五月综合激情日本mⅴ| 久久久综合视频| 欧美在线观看视频一区二区| 午夜精品成人在线视频| 久久人人97超碰com| 欧亚一区二区三区| 久草中文综合在线| 一区二区三区在线影院| 日韩欧美在线观看一区二区三区| 国产成人精品综合在线观看| 亚洲欧美日韩国产综合| 日韩欧美视频在线| 91蜜桃视频在线| 国产精品资源在线观看| 亚洲午夜精品一区二区三区他趣| 欧美一卡二卡三卡| 99免费精品在线观看| 麻豆免费看一区二区三区| 国产精品丝袜一区| 欧美va亚洲va在线观看蝴蝶网| 99视频一区二区| 国产一区在线观看视频| 亚洲午夜精品在线| 中文字幕中文字幕在线一区| 日韩欧美成人一区二区| 91美女福利视频| 国产精品羞羞答答xxdd| 亚洲图片有声小说| 亚洲日穴在线视频| 亚洲妇熟xx妇色黄| 国产精品免费丝袜| 欧美大片在线观看一区二区| 欧洲精品视频在线观看| 顶级嫩模精品视频在线看| 蜜臀av一区二区| 三级久久三级久久久| 亚洲影院久久精品| 伊人色综合久久天天| 中文字幕在线不卡视频| 欧美激情一区二区三区| 精品国内二区三区| 日韩美女天天操| 日韩欧美一区在线| 91精品久久久久久蜜臀| 欧美日韩不卡一区| 91福利资源站| 在线免费视频一区二区| 色噜噜偷拍精品综合在线| 99久久国产综合色|国产精品| 成人精品一区二区三区四区 | 久久伊99综合婷婷久久伊| 日韩午夜av一区| 日韩女优毛片在线| 日韩欧美激情一区| 日韩欧美www| 久久久精品tv| 国产精品毛片a∨一区二区三区| 中文字幕第一区综合| 国产精品久线观看视频| 亚洲色图视频免费播放| 一区二区在线观看视频 | 精品写真视频在线观看| 男人的天堂亚洲一区| 麻豆91小视频| 丰满少妇在线播放bd日韩电影| 丰满少妇久久久久久久| 成人免费毛片片v| 日本韩国欧美在线| 欧美精品777| 久久久另类综合| 中文字幕色av一区二区三区| 亚洲最新视频在线播放| 国产乱淫av一区二区三区| 北条麻妃国产九九精品视频| 在线免费观看视频一区| 7777精品伊人久久久大香线蕉经典版下载 | 欧美高清视频不卡网| 日韩欧美在线123| 国产日韩影视精品| 亚洲免费av网站| 久久黄色级2电影| 丁香婷婷综合色啪| 欧美日韩亚洲综合一区 | 91浏览器打开| 91精品国产综合久久久久久久久久 | 国产成人免费在线观看不卡| www.欧美色图| 日韩欧美中文字幕公布| 国产精品视频一二三区| 亚洲国产精品麻豆| 成人妖精视频yjsp地址| 欧美日韩国产成人在线91| 欧美国产日韩精品免费观看| 亚洲国产综合色| 成人av网在线| 日韩精品自拍偷拍| 久久成人麻豆午夜电影| 99久久er热在这里只有精品66| 在线成人免费视频| 尤物av一区二区| 国产1区2区3区精品美女| 欧美电影在线免费观看| 1区2区3区欧美|