Skip to content

Instantly share code, notes, and snippets.

-- SQL Movie-Rating View Modification Exercises[
-- Question 1
-- Write an instead-of trigger that enables updates to the title attribute of view LateRating.
-- Policy: Updates to attribute title in LateRating should update Movie.title for the corresponding movie. (You may assume attribute mID is a key for table Movie.) Make sure the mID attribute of view LateRating has not also been updated -- if it has been updated, don't make any changes. Don't worry about updates to stars or ratingDate.
--
-- Question 2
-- Write an instead-of trigger that enables updates to the stars attribute of view LateRating.
-- Policy: Updates to attribute stars in LateRating should update Rating.stars for the corresponding movie rating. (You may assume attributes [mID,ratingDate] together are a key for table Rating.) Make sure the mID and ratingDate attributes of view LateRating have not also been updated -- if either one has been updated, don't make any changes. Don't worry about updates to title.
--
-- Question 3
-- SQL Movie-Rating View Modification Exercises[
-- Question 1
-- Write an instead-of trigger that enables updates to the title attribute of view LateRating.
-- Policy: Updates to attribute title in LateRating should update Movie.title for the corresponding movie. (You may assume attribute mID is a key for table Movie.) Make sure the mID attribute of view LateRating has not also been updated -- if it has been updated, don't make any changes. Don't worry about updates to stars or ratingDate.
--
-- Question 2
-- Write an instead-of trigger that enables updates to the stars attribute of view LateRating.
-- Policy: Updates to attribute stars in LateRating should update Rating.stars for the corresponding movie rating. (You may assume attributes [mID,ratingDate] together are a key for table Rating.) Make sure the mID and ratingDate attributes of view LateRating have not also been updated -- if either one has been updated, don't make any changes. Don't worry about updates to title.
--
-- Question 3
@chinkouu
chinkouu / 1-SQL-Movie-Rating-Query-Exercises.sql
Last active August 29, 2015 14:14
斯坦福大学公开讲座 DB5 SQL(2014/6/6)练习题
/*这是斯坦福大学网络公开课DB5 SQL的练习题解答*/
/*第一部分:SQL Movie-Rating Query Exercises*/
/*数据环境准备*/
/* Delete the tables if they already exist */
drop table if exists Movie;
drop table if exists Reviewer;
drop table if exists Rating;
/* Create the schema for our tables */
create table Movie(mID int, title text, year int, director text);
@chinkouu
chinkouu / aaaa.txt
Last active December 26, 2015 00:38
gist repo
aaaa

What is this about?

If you're not in my SharePoint Web Developer Experience class, you're missing out. This is just some of the sample code we're discussing in the February 2013 delivery. There's another one coming up in May. And you get even more code than is shared here to the public.

Feel free to poke around. Geek out a bit. And if your curiosity is piqued, sign up for the next one.

@chinkouu
chinkouu / markdown.md
Last active December 23, 2015 01:38 — forked from azu/markdown.md
@chinkouu
chinkouu / rAF.js
Created September 14, 2013 03:38 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@chinkouu
chinkouu / Hello.txt
Last active December 22, 2015 23:58
Hello
= Hello =
Hello World!