當前位置:首頁 » 數據倉庫 » 資料庫創建銷售表
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

資料庫創建銷售表

發布時間: 2022-12-18 03:47:36

『壹』 mysql資料庫怎麼創建數據表並添加數據

1、運行Navicat資料庫管理工具,連接本地資料庫。點擊左上角「文件」或者工具欄「連接」圖標,創建自己的資料庫連接。Navicat for MySQL可以連接本地Mysql資料庫,還可以連接遠程Mysql資料庫。兩者連接方式基本相同。

『貳』 設計題 有一個MySQL資料庫store,在store資料庫中含有一個銷售表sale,用於存放商品的銷售記錄。

  1. use store;

  2. createtable sale(idintauto_incrementprimarykey,pm varchar(30) ,price decimal(9,2),num int,sum decimal(11,2));

  3. insert into sale(pm,price,num) values ('電視機',1400.00,4);

  4. select * from sale;

  5. update sale set sum = 0 ;

  6. select * from sale where price > 4000.00 order by sum desc

  7. method = "post"

  8. action = "calc_multi.php"

  9. a

  10. b

  11. c

  12. submit

  13. ...

『叄』 用SQL語句創表

CREATE TABLE S
(MNO VARCHAR2(10) PRIMARY KEY,
PNO VARCHAR2(10),
QTY NUMBER(20) NOT NULL);

用外碼得用引用另一個表。

『肆』 在資料庫中創建一張銷售表,求代碼就好 謝謝

創建表:create table ods_sales_detail(
訂單號 varchar2(11),
訂單日期 date,
組織編碼 clob,
銷售量 number,
銷售單價 number
);
插入數據:
insert into ods_sales_detail('訂單號',訂單日期,'組織編碼',銷售量,銷售單價) values('11022346220','2016-1-10','511',100000,1.89);

『伍』 資料庫SQL的建表問題!

-- 1、 在銷售商品的同時,將記錄庫存中該商品數量減少多少。

CREATE TRIGGER tg_receNO

ON sales FOR update

AS

begin

declare @oldnum int

declare @newnum int

set @oldnum=(select sale_number from deleted)

set @newnum=(select sale_number from inserted)

update stock set stock_number=stock_number-(@newnum-@oldnum)

--@newnum-@oldnum表示商品減少的數量

where dbo.stock.pro_id=(select pro_id from inserted)

end

『陸』 如何在資料庫中創建表

以下為創建MySQL數據表的SQL通用語法:
CREATE TABLE table_name (column_name column_type);
以下例子中我們將在 RUNOOB 資料庫中創建數據表runoob_tbl:
CREATE TABLE IF NOT EXISTS `runoob_tbl`(
`runoob_id` INT UNSIGNED AUTO_INCREMENT,
`runoob_title` VARCHAR(100) NOT NULL,
`runoob_author` VARCHAR(40) NOT NULL,
`submission_date` DATE,
PRIMARY KEY ( `runoob_id` )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
實例解析:
如果你不想欄位為 NULL 可以設置欄位的屬性為 NOT NULL, 在操作資料庫時如果輸入該欄位的數據為NULL ,就會報錯。
AUTO_INCREMENT定義列為自增的屬性,一般用於主鍵,數值會自動加1。
PRIMARY KEY關鍵字用於定義列為主鍵。 您可以使用多列來定義主鍵,列間以逗號分隔。
ENGINE 設置存儲引擎,CHARSET 設置編碼。

『柒』 用create table語句 在資料庫中建立銷售表xsb.dbf,其結構和記錄如下:

if(select count(*) from sysobjects where name = 'xsb') > 0
drop table xsb
go
create table xsb
(
銷售日期 char(4) not null ,
商品號 char(4) not null ,
進貨量 numeric(7,0) not null ,
銷售量 numeric(7,0) not null ,
銷售價 decimal(8,2) not null ,
庫存量 numeric(8,0) not null ,
)
go

『捌』 資料庫創建一個銷售表的帶參數的存儲過程

你這是要創建表呢還是創建存儲過程呢?
如果是創建表的話,
CREATE TABLE 銷售表(
銷售編號 類型,
商品編號 類型,
銷售價格 類型,
銷售數量 類型,
銷售日期 類型
);
如果是要創建一個帶入參的存儲過程,基本語法為:
CREATE OR REPLACE PROCEDURE P_TEST1(PARM IN VARCHAR2)
BEGIN
END;

『玖』 以下信息,,用T-SQL語言創建表

create database sale
go

use sale
go
create table g(
商品號 int primary key,
商品名 char(20) not null,
單價 decimal(9,2)
)
go
create table s(
商店號 int primary key ,
商店名 char(20) not null,
經理 char(8)
)
go
create table gs(
商店號 int not null,
商品號 int not null,
銷售量 int default(0)
)
go
alter table gs add constraint pk_store primary key(商店號,商品號)
go