NOT IN/NOT EXISTS/EXCEPT 使用注意事項
#SQL
【SQL Tips】之【 NULL處理技巧,使用NOT IN /NOT EXISTS/EXCEPT】
許多時候,兩個資料表要找出差異值的時候,許多人第一直覺就是使用【NOT IN】,當然大部分時候都不會有狀況,但是碰到NOT IN的子查詢資料值,如果有NULL,就全盤皆輸,意思就是找不出任何差異。這樣在小量資料可以藉由眼力觀察的狀況下,還可以找出這樣寫法NOT IN的危險地方,但是碰到背景程式,或是資料量多的時候,幾乎無法觀察到這樣危險。所以,告訴自己不要再用【NOT IN】去找出兩邊資料差異。
反倒是要使用【NOT EXISTS】寫法,雖然是複雜一點,但是跨越SQL Server與Oracle兩種資料庫,都是可以正常找出兩邊資料差異值,不擔心NOT EXISTS的基礎資料表有NULL值狀況。另外值得一提就是,需多人會直接使用SQL Server的【EXCEPT】與Oracle的【MINUS】方式,要留意再留意,這樣的方式雖然可以找出差異值,但是針對回傳值,會自動進行重複資料列移除。
【SQL Server Code】
if object_id('x') is not null
drop table x
go
--建立比對基礎資料
create table x(a int)
go
insert into x values(1)
insert into x values(1) --注意重複
insert into x values(NULL) --注意NULL
go
if object_id('y') is not null
drop table y
go
--建立簡單比對來源資料
create table y(b int not null)
go
insert into y values(1)
insert into y values(1)
insert into y values(2)
insert into y values(2)
insert into y values(2) --注意三個2
go
--三種找出y資料表中(1,1,2,2,2) 然後不存在於 x資料表中的(1,1,null)
--【預期要回傳三個2】
--第一種 使用NOT IN 注意(子查詢有NULL值)
--無法處理對比資料表有NULL狀況
SELECT b
FROM y
WHERE b NOT IN(SELECT a from x)
GO
--第二種 使用NOT EXISTS 注意(SELECT 需要 JOIN)
--忠實回傳三個2
SELECT b
FROM y
WHERE NOT EXISTS (SELECT * FROM x WHERE x.a = y.b)
GO
--第三種 使用EXCEPT (僅回傳一個2)
SELECT b FROM y
EXCEPT
SELECT a FROM x
GO
【Oracle Code】
drop table x purge;
--建立比對基礎資料
create table x(a int);
insert into x values(1);
insert into x values(1); --注意重複
insert into x values(NULL); --注意NULL
drop table y purge;
--建立簡單比對來源資料
create table y(b int not null);
insert into y values(1);
insert into y values(1);
insert into y values(2);
insert into y values(2);
insert into y values(2); --注意三個2
--三種找出y資料表中(1,1,2,2,2) 然後不存在於 x資料表中的(1,1,null)
--第一種 使用NOT IN 注意(子查詢有NULL值)
--無法處理對比資料表有NULL狀況
SELECT b
FROM y
WHERE b NOT IN(SELECT a from x);
--第二種 使用NOT EXISTS 注意(SELECT 需要 JOIN)
--忠實回傳三個2
SELECT b
FROM y
WHERE NOT EXISTS (SELECT * FROM x WHERE x.a = y.b);
--第三種 使用EXCEPT (僅回傳一個2)
SELECT b FROM y
MINUS
SELECT a FROM x;
同時也有10000部Youtube影片,追蹤數超過62萬的網紅Bryan Wee,也在其Youtube影片中提到,...
「oracle select into」的推薦目錄:
oracle select into 在 恶魔婷婷 哈拉日记 Facebook 八卦
The accelerating pace of digital transformation has raised consumer expectations to unprecedented levels, and is causing every organization to rethink how they engage with their customers. According to a recent survey by IDC¹, 72 percent of businesses reported that improving document processes would increase customer satisfaction, yet 80 percent of those processes still rely on paper. Companies focused on great experiences can no longer afford to be mired in document processes that are slow and inefficient. Their customers need and want a better way.
Adobe (Nasdaq:ADBE) today unveiled the first integration between Adobe Sign and Adobe Marketing Cloud, eliminating the cost and frustration of manual, paper-based process for enrollment, onboarding and servicing across the customer journey. Adobe Sign (formerly Document Cloud eSign services) features an upgraded and modernized mobile app experience, and works seamlessly with Adobe Experience Manager (AEM) Forms - a key part of Adobe Marketing Cloud - helping organizations to go completely digital with anything from credit card applications to government benefit forms or medical forms. And building on widespread adoption in Europe, Adobe is rolling out new data centers and meeting the most stringent legal requirements in the EU, part of a global expansion that will continue through 2016.
Adobe also announced new Document Cloud storage integrations with Box and Microsoft OneDrive, which make it easier to access and work on PDF files from anywhere, as well as new features for Adobe Acrobat DC subscribers, delivering on the promise of ongoing innovation and value through Document Cloud.
“Every company and organization should be laser-focused on delivering the best customer experience possible, and the best experience does not involve paper,” said Bryan Lamkin, executive vice president and general manager, Digital Media at Adobe. “Today we further strengthen the value that Adobe Document Cloud and Adobe Sign bring to our global customers as the only complete solution that transforms paper-based transactions into 100 percent digital workflows.”
“Talking to businesses and partners around Asia Pacific, I see a real sense of urgency around transforming customer experience by making it seamless, pain-free, and accessible across all devices and touchpoints,” said Michael Stoddart, Director of Digital Media, Adobe Asia Pacific. “In its annual predictions for 2016, IDC believes that by the end of the year, 60 percent of the top 1000 enterprises in APAC will have digital transformation (DX) at the center of their corporate strategy, with a majority even creating an independent position to oversee the DX strategy implementation. Adobe is working with businesses across the region to help them create points of differentiation by making their core processes more customer-centric.”
At the heart of Document Cloud is Acrobat DC, the world’s best PDF solution; Adobe Sign, the leading e-signature solution that allows anyone to electronically sign and send documents from any device; and powerful companion mobile apps. More than six billion digital and electronic signature transactions are processed through Document Cloud each year, including global businesses like AmerisourceBergen, The Royal Bank of Scotland and Verizon and businesses in Asia Pacific like Stratton, one of Australia’s largest car and asset finance brokers, which rely on Document Cloud and Adobe Sign for fast, secure and mobile e-signatures.
“At Royal Bank of Scotland, we put our customers’ experience first when rolling out new services to make their lives a little easier,” said Ankit Chhajer, Digital Lead – Customer Experience and Sales Innovation, Royal Bank of Scotland. “Building on our broad adoption of Adobe Marketing Cloud, we are now turning to Adobe Document Cloud and Adobe Sign to create an elegant, hassle free customer experience that rivals none other.”
“Electronic signatures have reduced paperwork turnaround time from days to minutes, helping sales consultants finalize financing quickly,” said Andrew Lawrence, Software Development Manager, stratton. “Technology has always been a way for us to set ourselves apart, and we expect the new integrations in Adobe Sign will offer critical business services that we can use to close deals faster.”
Introducing Powerful New Capabilities with Adobe Sign
Adobe Sign is the fast, easy, secure way to bring trusted e-signatures to every organization and department including HR, sales, IT, legal and procurement, to name a few. New functionality includes:
· Transforming digital experiences – The integration between Adobe Sign and Experience Manager Forms turns complex, form-based processes into simple, engaging, mobile-optimized digital experiences across the entire customer journey. This includes how a person discovers the right form that they need, fills it out easily and successfully on any device, electronically signs it, and gets status updates once it is submitted. Using the integration between Adobe Sign and Adobe Marketing Cloud, organizations can provide responsive, adaptive experiences, enable personalization to continually improve the user experience with Adobe Target, and analyze and optimize performance with Adobe Analytics. Government, financial services and healthcare are just a few of the industries that will benefit from this service.
· Furthering global e-signature and digital signature adoption – Building on widespread adoption in Europe, and as part of a global rollout, new data centers are now live in the EU. With a secure, standards-based approach, Adobe Sign meets the most stringent legal requirements so European organizations can go digital in compliance with eIDAS, the new EU signature regulation set to take effect in July 2016.
· Delivering enhanced mobile signing – Sending, tracking and managing documents on tablets and smartphones is now easier than ever with the Adobe Sign app for iOS and Android (formerly Adobe eSign Manager DC). An updated dashboard and improved send for signature workflow enable users to be even more productive on any device.
Rapidly Expanding Document Cloud Partner Ecosystem
Adobe is focused on enabling people to use Document Cloud with solutions they already use as part of their day-to-day work. Document Cloud already offers integrations with industry leaders like Apttus, Dropbox, Salesforce, Workday, and more. Adobe today is unveiling integrations with best-in-class cloud storage providers Box and Microsoft, along with new and expanded Adobe Sign integrations that span key business solutions and workflows.
· Box – New offerings integrate Acrobat DC, Acrobat Reader and Adobe Sign with Box to simplify document workflows, as well as e-signature processes for enterprises. Whether users start from Box or Adobe, with just a few clicks they will be able to view and edit PDFs without any downloading, and ensure that the latest version is automatically secured in Box. Additionally, users can open Box files directly in Adobe Sign to provide an electronic signature on important contracts and paperwork, centralizing all updates in Box and streamlining the approval process.
· Microsoft OneDrive – New integration with Acrobat DC, Acrobat Reader and Microsoft OneDrive allows organizations to access and work on PDF files stored in OneDrive directly from within the Adobe apps. With a few clicks in Acrobat on the desktop, users can view and work on PDF files stored in OneDrive while ensuring documents always remain synced. In addition, iOS users can access PDFs in OneDrive from the Acrobat Reader mobile app via the universal document picker, enabling them to work with PDF files anywhere.
· Salesforce – The latest release of Adobe Sign significantly improves a user’s experience. Expected to be available in beta in May 2016, the update features the enhanced Salesforce Lightning user experience across any device, plus support for customizing the app with the drag-and-drop interface of Salesforce Lightning Components—while also providing compelling new features like signing groups and hybrid signing order. SteelBrick, recently acquired by Salesforce, also has an existing integration with Adobe Sign for helping speed the Configure Price Quote (CPQ) process.
· Adobe Sign Ecosystem Momentum – Many new and updated integrations significantly expand the Adobe Sign ecosystem across common enterprise solutions—such as business process automation, contract lifecycle management and enterprise resource planning—and include Advanced Software Concepts (ASC), Buildium, McKesson Contract Manager, Namely, Oracle, SciQuest, SpringCM, and ThinkSmart.
Ongoing Innovation with Subscription to Acrobat DC
At the heart of Document Cloud, a subscription to Acrobat DC delivers instant access to new features and enhancements as soon as they’re available. Today, Adobe introduced:
· Updated tools for everyday use – Modernized commenting and annotation tools are now fully updated with an intuitive, touch-friendly interface that makes it easier than ever to give and get fast, clear feedback; a highlighter pen can now mark up scanned documents without the need for optical character recognition (OCR); and paper-to-digital workflows like scanning are now optimized to deliver the best results.
· Unrivaled accessibility – Adobe is adding critical menu and dialog updates to enhance the experience for users with visual impairments who rely on Acrobat DC to work with PDFs. The Home view and Save As options can now be read aloud by screen readers for greater accessibility.
· Streamlined deployment – Adobe team and enterprise customers can now deploy and update Acrobat DC with Creative Cloud apps using the Adobe Creative Cloud packager.
Pricing and Availability
· The new Adobe Sign capabilities are expected to be available to customers in May 2016. Find out more.
· The new Acrobat features will be automatically available to subscribers of Acrobat DC in May 2016. Find out more.
· The ability to add a Box account to Acrobat DC and Acrobat Reader on desktop is expected by the end of May 2016. The ability for Acrobat Reader mobile users on iPhone and iPad to select Box as their preferred cloud service from the iOS document picker is expected by the end of June 2016. Initial access to Acrobat DC and Adobe Sign from the Box website is expected by the end of May 2016, with deeper integration expected by Fall 2016.
· The ability to add a OneDrive account to Acrobat DC and Acrobat Reader on desktop, and the ability for Acrobat Reader mobile users on iPhone and iPad to select OneDrive as their preferred cloud storage provider from the iOS universal document picker, is expected by the end of June 2016.
¹IDC InfoBrief, sponsored by Adobe, Business Transformation Through Smarter Document Workflows, April 2016.
Helpful Links:
· Learn more about Adobe Sign
· Learn more about Adobe Sign and Experience Manager Forms for paperless onboarding
· Hear from Adobe EVP and GM Bryan Lamkin on meeting customer needs with Document Cloud
· Learn more about advancements in Document Cloud from Adobe VP of product management, Jon Perera
· Read the blog on e-signature advancements in Europe by Dan Puterbaugh, director and associate general counsel, Adobe
· Read the guest blog from Box
· Follow us on Adobe SEA Facebook page
About Adobe
Adobe is changing the world through digital experiences. For more information, visit www.adobe.com/sea.