[training]ASP.NET MVC 5 – DML 資料操縱語言1

INSERT..()
  VALUE..()

INSERT SCORE (SID, COURSE, SCORE)
  VALUES ('S001', '程式設計', 86)

INSERT SCORE (SID, COURSE, SCORE)
  VALUES ('A003', '程式設計', 74)

由於各欄位不可為NULL,故語法可以省略為下:

INSERT SCORE
  VALUE ('S002', '演算法', 77)

INSERT SCORE
  VALUE ('S003', '演算法', 57)

===============

UPDATE..
  SET..=
  WHERE..=

UPDATE SCORE
  SET COURSE = '物件導向程式設計',
      SCORE = 95
  WHERE SID = 'S001'

=================

DELETE FROM..
  WHERE..=

DELETE FROM SCORE
  WHERE SID = 'S003'

=================

SELECT * FROM SCORE

SELECT SID AS '學號', COURSE AS '科目名稱', SCORE AS '分數" FROM SCORE

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.