Python/ MySQL练习题(一) 查询“生物”课程比“物理”课程成绩高的所有学生的学号 SELECT * FROM ( SELECT * FROM course LEFT JOIN score ON score.course_id = course.cid WHERE course.cname = '生物' ) AS A INNER JOIN ( SELECT * FROM course LEFT JOIN score ON score.course_id = course.cid WHE…
python/MySQL练习题(二) 查询各科成绩前三名的记录:(不考虑成绩并列情况) select score.sid,score.course_id,score.num,T.first_num,T.second_num from score left join ( select sid, (select num from score as s2 where s2.course_id = s1.course_id order by num desc limit 0,1) as first_nu…
1.数据库是按照原文制作的,表格结构一样具体存储的数据有些差异 原文地址:MySQL练习题 原答案地址:MySQL练习题参考答案 2.查询“生物”课程比“物理”课程成绩高的所有学生的学号: select wl.sid from (select sc.student_id as sid,sc.number as grade from score sc,course c where c.cid=sc.course_id and c.cname='物理') as wl,(select sc.stude…
新建一个叫做 review 的数据库,将测试数据脚本导进去.(可以使用Navicat查询功能) /* Navicat MySQL Data Transfer Source Server : DB Source Server Version : 50723 Source Host : localhost:3306 Source Database : review Target Server Type : MYSQL Target Server Version : 50723 File Encodi…
原帖地址:http://www.cnblogs.com/wupeiqi/articles/5748496.html 范例数据sql: /* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50624 Source Host : localhost Source Database : sqlexam Target Server Typ…
1.创建表结构和数据 /* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50624 Source Host : localhost Source Database : sqlexam Target Server Type : MySQL Target Server Version : 50624 File Encoding :…
init.sql文件内容 /* 数据导入: Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50624 Source Host : localhost Source Database : sqlexam Target Server Type : MySQL Target Server Version : 50624 File Enc…
#!/usr/bin/pythonfrom flask import Flask,render_template,request,redirect,sessionimport MySQLdb as mysql con = mysql.connect(host='59.110.**.**',user='woniu',passwd='123456',db='wangjin')con.autocommit(True)cur =con.cursor() app = Flask(__name__)impo…
SELECT from Nobel Tutorial 1.Change the query shown so that it displays Nobel prizes for 1950. SELECT yr, subject, winner FROM nobel : 2.Show who won the 1962 prize for Literature. and subject='literature'; 3.Show the year and subject that won 'Alber…
首先查看world表的字段: name continent area population gdp capital tld flag SELECT * FROM world: 2.显示人口至少为2亿的国家/地区的名称.2亿=200million SELECT name FROM world ; 3.给出人口至少2亿的国家的名称和人均国内生产总值. ; 4.显示continent ='South America'的国家的名称和人口. 将人口除以100万,以获得数百万人口,也就是population…